curray
Version:
Curray is an extension library for the native JavaScript Array object.
33 lines • 1.73 kB
TypeScript
/**
* Check if the given argument is an object
* @param x argument
*/
export declare const isObj: <T>(x: T) => boolean;
/**
* Creates a function that negates the result of the predicate
*/
export declare const negate: <T>(predicate: (value: T, index?: number, list?: T[] | undefined) => boolean) => (value: T, index?: number, list?: T[] | undefined) => boolean;
export declare const composeComparers: <T>(previousComparer: (a: T, b: T) => number, currentComparer: (a: T, b: T) => number) => (a: T, b: T) => number;
export declare const keyComparer: <T, TKey>(keySelector: (key: T) => TKey, descending?: boolean) => (a: T, b: T) => number;
/**
* Represents a sorted sequence. The methods of this class are implemented by using deferred execution.
* The immediate return value is an object that stores all the information that is required to perform the action.
* The query represented by this method is not executed until the object is enumerated either by
* calling its ToDictionary, ToLookup, ToList or ToArray methods
*/
export declare class OrderedArray<T, TKey> extends Array<T> {
private readonly _comparer;
static get [Symbol.species](): ArrayConstructor;
constructor(elements: T[], _comparer: (a: T, b: T) => number);
/**
* Performs a subsequent ordering of the elements in a sequence in ascending order according to a key.
* @override
*/
thenBy(keySelector: (key: T) => number | string): OrderedArray<T, TKey>;
/**
* Performs a subsequent ordering of the elements in a sequence in descending order, according to a key.
* @override
*/
thenByDescending(keySelector: (key: T) => number | string): OrderedArray<T, TKey>;
}
//# sourceMappingURL=helpers.d.ts.map