@volverjs/ui-vue
Version:
@volverjs/ui-vue is a lightweight Vue 3 component library to accompany @volverjs/style.
83 lines (82 loc) • 3.1 kB
TypeScript
import type { Ref } from 'vue';
/**
* Compare objects, primitives, array, dates, regexp
* @param {any} obj1 first literal
* @param {any} obj2 second literal
* @param {string} field optional field of obj1 and obj2 (also nested dotted field "prop1.prop12")
* @returns {boolean}
*/
export declare function equals(obj1: any, obj2: any, field?: string): boolean;
/**
* Compare objects, primitives, array, dates, regexp
* @param {any} a first literal
* @param {any} b second literal
* @returns {boolean}
*/
export declare function deepEquals(a: any, b: any): boolean;
/**
* Find and return field or nested field from object (also nested dotted field)
* @param {object} data object that contains the field
* @param {string} field ex: "prop1" or "prop1.prop12"
* @returns {boolean} the field value
*/
export declare function resolveFieldData(data: Record<string, unknown>, field: string): unknown;
/**
* @param {any} obj data to check
* @returns {boolean}
*/
export declare function isFunction(obj: any): boolean;
/**
* Return the index of value in list array
* @param {any} value the element to find
* @param {Array<any>} list array list
* @returns {number} the index
*/
export declare function findIndexInList<Type = unknown>(value: Type, list: Type[]): number;
/**
* Return the index of value in list array
* @param {any} value the element to find
* @param {Array<any>} list array list
* @returns {boolean} the index
*/
export declare function contains<Type = unknown>(value: Type, list: Type[]): boolean;
/**
* @param {boolean | string | null | undefined | number | Array<unknown> | object} value element to checj
* @returns {boolean} true if value is empty
*/
export declare function isEmpty(value: boolean | string | null | undefined | number | unknown[] | object | Ref): boolean;
/**
* Return the object entries that match the predicate passed
* @param {object} value
* @param {Function} predicate
* @returns {object} the object entries
*/
export declare function pickBy(value: Record<string, unknown>, predicate: (k: string) => boolean): {
[k: string]: unknown;
};
/**
* Remove a value from an Array
* @param {any} value the element to remove
* @param {Array<any>} list
* @returns {Array<any>} the list without the value
*/
export declare function removeFromList<Type = unknown>(value: Type, list: Type[]): Type[];
/**
* @param {any} value
* @returns {boolean} true if value is a string
*/
export declare function isString(value: unknown): value is string;
/**
* Convert props definition to object with "prop" as key and default as value
* @param {ComponentObjectPropsOptions} props vue component props
* @returns {object}
*/
export declare function propsToObject(props: any): Record<string, unknown>;
/**
* Filter array objects by filter array
* @param {object[]} list the listo to filter
* @param {object[] | string[]} filter the filter list, array of string or array of object
* @param {string} key
* @return {object[]}
*/
export declare function filterArray<T = Record<string, unknown>>(list: T[], filter: T[] | string[], key: string): T[];