bootstrap-vue-next
Version:
Seamless integration of Vue 3, Bootstrap 5, and TypeScript for modern, type-safe UI development
44 lines (43 loc) • 2.19 kB
TypeScript
/**
* You need this because fundamentally isArray can't make the assumption that a readonly array is of type array
* Only that `readonly T[]` has array like properties. So it breaks a bit when making things "readonly"
*/
export declare const isReadOnlyArray: <T>(arr: unknown) => arr is readonly T[];
/**
* Removes properties from an object, based on the values in an array, and returns the new object.
* Equivalent to an object version of TS Omit<>
*/
export declare const omit: <A extends Record<PropertyKey, unknown>, const B extends ReadonlyArray<PropertyKey>>(objToPluck: Readonly<A>, keysToPluck: Readonly<B> | readonly (keyof A)[]) => Omit<A, B[number]>;
/**
* Picks properties from an object, base on the values in an array, and returns the new object.
* Equivalent to an object version of TS Pick<>
*/
export declare const pick: <A extends Record<PropertyKey, unknown>, const B extends ReadonlyArray<PropertyKey>>(objToPluck: Readonly<A>, keysToPluck: Readonly<B> | readonly (keyof A)[]) => Pick<A, B[number]>;
/**
* Dynamically get a nested value from an array or
* object with a string.
*
* @example get(person, 'friends[0].name')
*
* Thanks to
* @link https://github.com/rayepps/radash/blob/master/src/object.ts#L214
*
* @deprecated The purpose of this function is to allow one to use "dot notation" to pick nested properties from an object.
* Usually for props, it would be better to use a function that picks the property you want instead of relying on weak string paths
* Using a function allows for better type safety.
*/
export declare const get: <TDefault = unknown>(value: any, path: string, defaultValue?: Readonly<TDefault>) => TDefault;
/**
* Opposite of get, dynamically set a nested value into
* an object using a key path. Does not modify the given
* initial object.
*
* @example
* set({}, 'name', 'ra') // => { name: 'ra' }
* set({}, 'cards[0].value', 2) // => { cards: [{ value: 2 }] }
*
* Thanks to
* @link https://github.com/rayepps/radash/blob/master/src/object.ts#L214
*/
export declare const set: <T extends object, K>(initial: T, path: string, value: K) => T;
export declare const deepEqual: (a: any, b: any) => boolean;