UNPKG

@cervello/react

Version:

🤯 Simple, reactive, tiny and performant state-management library

44 lines (43 loc) • 1.58 kB
/** * Clones all the provided object and nested properties and it also * iterates nested arrays to deepClone them * * @param obj - base object to be cloned * @returns new cloned object with new reference */ export declare function deepClone<T>(obj: T): T; export declare function deepClone2<T>(obj: T): T; /** * Guard to check is variable is an object * @param obj - variable to be checked * @returns boolean */ export declare const isObject: (obj: unknown) => obj is Record<string | symbol, unknown>; export declare const isReactElement: (obj: unknown) => boolean; export declare function isReactObjectLikeNode(obj: unknown): boolean; export declare function isValidReactiveObject<T extends Record<string, any>>(value: T): boolean; /** * Returns the actual target value instead of root * object with internals props like $$value$$ * * @param target - object from subscription or proxy * @returns actual value */ export declare const okTarget: (target: any) => any; /** * Gets an object with just the properties requested * instead of the full object * * @param properties - object properties * @param obj - target to get the properties * @returns New object with just the requested properties */ export declare function getPartialObjectFromProperties<T>(properties: Array<keyof T>, obj: T): any; /** * Compare 2 provided objects by stringing them * @param a - first object * @param b - second object * @returns boolean */ export declare const contentComparer: (a: any, b: any) => boolean; export declare function safeToJson(obj: any): Record<string, any>;