/** * Converts a string into a dashed string by adding a dash before capitalized letters. No dashes are added before * capital letters if the capital letters are at the start of the string * @example * dasherize('MyString') === 'my-string'; * dasherize('OBBCConnection') === 'odbcconnection'; * @param text text that will be converted into a dashed string */ export declare function dasherize(text: string): string; /** * Executes an async callback function for each element of an array, and returns a new array based on the returned results of the callback * @example * const newArray = await asyncMap([1,2,4], async (val, index) => await someAsyncLogic(val)) * @param array source array which will be mapped * @param fn async function that takes in the array element and its' index, returning the mapped element */ export declare function asyncMap(array: ArrayType[], fn: (item?: ArrayType, index?: number) => Promise): Promise; /** * Executes an async callback for each element of an array * @example * await asyncForEach([1,2,4], async (val, index) => await someAsyncLogic(val)) * @param array source array which will trigger the function execution for each element * @param fn async function that takes in the array element and its' index */ export declare function asyncForEach(array: ArrayType[], fn: (item?: ArrayType, index?: number) => Promise): Promise; /** * Returns an array of duplicates from a given array. Duplicates are returned as an array of the underlying array elements * @example * const duplicates = getDuplicates([ * { name: 'John', age: 12 }, * { name: 'John', age: 5 }, * { name: 'Susan', age: 10 } * ], person => person.name) * * duplicates === [[{ name: 'John', age: 12 }, { name: 'John', age: 5 }]] // true * @param list List which may contain duplicate values * @param property Callback function that returns the property value for which to consider duplicates */ export declare function getDuplicates(list: T[], property: (item: T) => any): T[][]; /** * Returns an array where duplicates have been removed based on a specified condition * @example * removeDuplicates([ * { name: 'John', age: 12 }, * { name: 'John', age: 5 }, * { name: 'Susan', age: 10} * ], (person1, person2) => person1.name === person2.name) * @param list List which may contain duplicates * @param condition A callback function that should return a boolean from a comparision between to elements of the array */ export declare function removeDuplicates(list: T[], condition: (item: T, item2: T) => boolean): T[]; /** * To ensure that each element in an array is unique for some specified property. Throws an error where duplicates are found * @example * validateUniqueValues([ * { name: 'John', age: 12 }, * { name: 'John', age: 5 }, * { name: 'Susan', age: 10 } * ], * person => person.name, * (duplicateName, person1, person2) => `Two people exist with the same name '${duplicateName}'` * ) * @param list List which may contain duplicates * @param property A callback function that returns the property for which to consider uniqueness * @param errorMessage A callback that returns the error message that is thrown if duplicates are found. * This callback has one required argument being the duplicate value, as well as the optional arguments being the two * elements that contain this duplicate value */ export declare function validateUniqueValues(list: T[], property: (item: T) => T2, errorMessage: (duplicateValue: T2, item1?: T, item2?: T) => string): void; /** * Checks whether provided argument is a class constructor * @example * class MyClass {} * isConstructor(MyClass) // equals true * @param value constructor or other type */ export declare function isConstructor(value: any): boolean; /** * Returns an array * @example * arrayValue(1) // equals [1] * arrayValue([1]) // equals [1] * @param value array or non-array value */ export declare function arrayValue(value: T | T[]): T[];