UNPKG

confinode

Version:

Node application configuration reader

25 lines (24 loc) 946 B
/** * Push the item in the array if the item is defined and not already in the array. * * @param array - The array in which item is to be pushed. * @param item - The item to push. * @param predicate - The predicate to see if item is already in the array. */ export declare function pushIfNew<T>(array: T[], item: T | undefined, predicate: (arrayItem: T) => boolean): void; /** * A predicate to use as an array filter in order to remove duplicates. * * @param value - The value to test. * @param index - The index of the current value. * @param array - The array. * @returns True if value is unique. */ export declare function unique<T>(value: T, index: number, array: T[]): boolean; /** * Ensure that the given parameter is an array. If not, put it in an array. * * @param value - Either an array or a single item to convert. * @returns The parameter in an array. */ export declare function ensureArray<T>(value: T | T[]): T[];