UNPKG

@shopware-ag/meteor-component-library

Version:

The meteor component library is a Vue component library developed by Shopware. It is based on the [Meteor Design System](https://shopware.design/).

40 lines (39 loc) 2.04 kB
/** * Deep copy an object */ export declare function deepCopyObject<O extends object>(copyObject: O): O; export declare function hasOwnProperty(scope: any, prop: string): boolean; type GetPath = string | number | (string | number)[]; /** * Safely retrieves a value from a nested object using a path. */ export declare const get: <T extends object, D = undefined>(obj: T | null | undefined, path: GetPath, defValue?: D) => D | undefined | any; /** * Retrieves a value from an object using a property path, with support for fallback paths. * When given an array of paths, returns the first non-empty value found. * * @param object - The source object to extract the value from * @param propertyPath - Either a single string path or an array of string paths to try in order * @param defaultValue - Value to return if no non-empty value is found * @returns The first non-empty value found, or the default value if none found */ export declare function getPropertyValue(object: any, propertyPath: string | string[], defaultValue?: any): any; /** * Takes two objects and merges them deeply. * If a property exists in both objects and is an object itself, it will merge them recursively. * If a property exists in the source object but not in the target, it will be added to the target. * If a property exists in the target but not in the source, it will remain unchanged. * If a property exists in both objects but is not an object, the source value will overwrite the target value. * * @param target - The target object to merge into * @param source - The source object to merge from * @return The merged object */ export declare function deepMergeObjects<T extends object>(target: T, source: Partial<T>): T; declare const _default: { deepCopyObject: typeof deepCopyObject; hasOwnProperty: typeof hasOwnProperty; get: <T extends object, D = undefined>(obj: T | null | undefined, path: GetPath, defValue?: D) => D | undefined | any; getPropertyValue: typeof getPropertyValue; }; export default _default;