@bitblit/ratchet-common
Version:
Common tools for general use
14 lines (13 loc) • 613 B
TypeScript
export declare class ArrayRatchet {
static wrapElementsInArray(input: any[]): any[][];
static compareTwoArrays<T>(ar1: T[], ar2: T[], fn: ComparisonFunction<T>): MatchReport<T>;
static extractSubarrayFromSortedByNumberField<T>(input: T[], fieldDotPath: string, minInclusive: number, maxExclusive: number): T[];
static findSplit(input: any[], fieldDotPath: string, target: number): number;
static shuffleInPlace(array: any[]): void;
}
export type ComparisonFunction<T> = (t1: T, t2: T) => number;
export interface MatchReport<T> {
matching: T[];
setOneOnly: T[];
setTwoOnly: T[];
}