@o3r/core
Version:
Core of the Otter Framework
37 lines • 1.25 kB
TypeScript
/** Reviver Mapper to detect and create object on deepFill */
export interface PrimitiveReviverMapper<T = any> {
/** Condition to fill to be determine as */
condition: (data: any) => boolean;
/**
* Construct the primitive type if needed
* @param data to be constructed
* @default {@see defaultConstruct}
*/
construct?: (data: any) => T;
}
/**
* Check if an object is not an array or a date
* @param obj
* @param additionalMappers
*/
export declare function isObject(obj: any, additionalMappers?: PrimitiveReviverMapper[]): boolean;
/**
* Return a new reference of the given object
* @param obj
* @param additionalMappers
*/
export declare function immutablePrimitive(obj: any, additionalMappers?: PrimitiveReviverMapper[]): any;
/**
* Deep fill of base object using source
* It will do a deep merge of the objects, overriding arrays
* All properties not present in source, but present in base, will remain
* @param base
* @param source
* @param additionalMappers Map of conditions of type mapper
*/
export declare function deepFill<T extends {
[x: string]: any;
}>(base: T, source?: {
[x: string]: any;
}, additionalMappers?: PrimitiveReviverMapper[]): T;
//# sourceMappingURL=deep-fill.d.ts.map