object.d.ts 1.9 KB

123456789101112131415161718192021222324252627
  1. export declare function iterateObject<T>(object: {
  2. [p: string]: T;
  3. } | T[] | undefined, callback: (key: string, value: T) => void): void;
  4. export declare function cloneObject<T>(object: T): T;
  5. export declare function deepCloneObject<T>(object: T): T;
  6. export declare function getProperty<T, K extends keyof T>(object: T, key: K): any;
  7. export declare function setProperty<T, K extends keyof T>(object: T, key: K, value: any): void;
  8. /**
  9. * Will copy the specified properties from `source` into the equivalent properties on `target`, ignoring properties with
  10. * a value of `undefined`.
  11. */
  12. export declare function copyPropertiesIfPresent<S, T extends S, K extends keyof S>(source: S, target: T, ...properties: K[]): void;
  13. /**
  14. * Will copy the specified property from `source` into the equivalent property on `target`, unless the property has a
  15. * value of `undefined`. If a transformation is provided, it will be applied to the value before being set on `target`.
  16. */
  17. export declare function copyPropertyIfPresent<S, T extends S, K extends keyof S>(source: S, target: T, property: K, transform?: (value: S[K]) => any): void;
  18. export declare function getAllKeysInObjects(objects: any[]): string[];
  19. export declare function mergeDeep(dest: any, source: any, copyUndefined?: boolean): void;
  20. export declare function assign<T, U>(target: T, source: U): T & U;
  21. export declare function assign<T, U, V>(target: T, source1: U, source2: V): T & U & V;
  22. export declare function assign<T, U, V, W>(target: T, source1: U, source2: V, source3: W): T & U & V & W;
  23. export declare function missingOrEmptyObject(value: any): boolean;
  24. export declare function get(source: any, expression: string, defaultValue: any): any;
  25. export declare function set(target: any, expression: string, value: any): void;
  26. export declare function deepFreeze(object: any): any;
  27. export declare function getValueUsingField(data: any, field: string, fieldContainsDots: boolean): any;