/** * Copyright (c) 2020-present, Goldman Sachs * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ export { cloneDeep as deepClone, isEqual as deepEqual, findLast, isEmpty, pickBy, uniqBy, uniq, debounce, throttle, } from 'lodash-es'; export type { DebouncedFunc } from 'lodash-es'; export { v4 as uuid } from 'uuid'; export declare type Clazz = { new (...args: any[]): T; }; /** * As mentioned above for `Clazz`, there is no good way to represent abstract class so * we will use `Function` in this case, this is a very loose check and will lose some benefit of type checking * during compile time, so refrain from using it extensively */ export declare type GenericClazz = { new (...args: any[]): T; } | Function; export declare type SuperGenericFunction = (...args: any) => any; export declare const getClass: (obj: object) => Clazz; export declare const getSuperClass: (_class: GenericClazz) => GenericClazz | undefined; /** * Check if the specified class is either the same as, or is a superclass of the provided class. */ export declare const isClassAssignableFrom: (cls1: GenericClazz, cls2: GenericClazz) => boolean; export declare const noop: () => (() => void); /** * Recursively omit keys from an object */ export declare const recursiveOmit: (obj: Record, keysToRemove: string[]) => Record; /** * Recursively remove fields with undefined values in object */ export declare const pruneObject: (obj: Record) => Record; export declare const shallowStringify: (object: unknown) => string; export declare const generateEnumerableNameFromToken: (existingNames: string[], token: string) => string; export declare const compareLabelFn: (a: { label: string; }, b: { label: string; }) => number; export declare const getNullableFirstElement: (array: T[]) => T | undefined; /** * This is a dummy type that acts as a signal to say the type should be plain object with shape rather than prototype object of type * NOTE: This is useful in network client interface where we enforce that the input and output for the network call must be plain object, * so as to force proper handling (i.e. deserialize/serialize) but also signal from documentation perspective about the type/shape of the plain object */ export declare type PlainObject = Record; /** * NOTE: This object mutates the input object (obj1) * To disable this behavior, set `createClone=true` */ export declare const mergeObjects: (obj1: T, obj2: V, createClone: boolean) => T & V; export declare const promisify: (func: () => T) => Promise; export declare const addUniqueEntry: (array: T[], newEntry: T, comparator?: (val1: T, val2: T) => boolean) => boolean; export declare const changeEntry: (array: T[], oldEntry: T, newEntry: T, comparator?: (val1: T, val2: T) => boolean) => boolean; export declare const deleteEntry: (array: T[], entryToDelete: T, comparator?: (val1: T, val2: T) => boolean) => boolean; export declare type GeneratorFn = Generator, // force to manually handle casting for any promise called within the generator function T>; export declare const printObject: (value: unknown, options?: { deep?: boolean | undefined; } | undefined) => string; //# sourceMappingURL=CommonUtils.d.ts.map