delphirtl
Version:
RTL functions from Delphi
35 lines (34 loc) • 1.1 kB
TypeScript
/**
* Deduplicates the given array
* @param values An array containing duplicated elements
* @returns The given array, but without duplicates
* @category Arrays
*/
declare function dedupArray(values: any[]): any[];
/**
* Gets the length of the longest string in the given values array.
*
* @param {string[]} values
* @returns {number} The length of the longest string in the given values array.
* @category Arrays
*/
declare function maxLen(values: string[]): number;
/**
* Sorts the given values array and returns it
*
* @param {string[]} values
* @param {boolean} [ascending=true]
* @returns {string[]} The sorted values array, in a new array.
* @category Arrays
*/
declare function sort(values: string[], ascending?: boolean): string[];
/**
* Compare all elements of arr1 and arr2 and ensure they have no duplicates
* @param arr1
* @param arr2
* @param key
* @returns true if there's duplicates, false otherwise
* @category Arrays
*/
declare function haveNoDuplicates(arr1: any[], arr2: any[], key: string): boolean;
export { haveNoDuplicates, dedupArray, maxLen, sort };