@plurid/plurid-functions
Version:
General Utility Functions for Plurid Applications
47 lines (46 loc) • 1.1 kB
TypeScript
/**
* Returns the range of integers between start (including) and end (excluding).
*
* https://dev.to/namirsab/comment/2050
* @param start
* @param end
*/
export declare const range: (start: number, end: number) => number[];
/**
* Check if two arrays are equal.
*
* @param a
* @param b
*/
export declare const equal: <T>(a: T[], b: T[]) => Boolean;
/**
* Move the `from` indexed item to the `to` indexed item of an array.
*
* @param items
* @param from
* @param to
*/
export declare const move: <T>(items: T[], from: number, to: number) => T[];
/**
* Swap item `a` with `b`.
*
* @param items
* @param a
* @param b
*/
export declare const swap: <T>(items: T[], a: number, b: number) => T[];
/**
* Get unique items based on their `identifier`.
*
* @param array
* @param identifier default `'id'`
* @returns
*/
export declare const unique: <T = any>(array: T[], identifier?: string) => T[];
/**
* Shuffles the `values` of an array.
*
* @param array
* @returns
*/
export declare const shuffle: <T = any>(values: T[]) => T[];