@qudtlib/core
Version:
Data model for QUDTLib
32 lines (31 loc) • 1.9 kB
TypeScript
import { SupportsEquals } from "./baseTypes.js";
import { Decimal } from "decimal.js";
export declare function getLastIriElement(iri: string): string;
interface EqualsComparator<Type> {
(left: Type, right: Type): boolean;
}
/**
* Compares two instances, `left` and `right`, yielding a negative result if `left` is smaller,
* a positive result if `left` is greater, and 0 if they are equal.
*/
export interface OrderComparator<Type> {
(left: Type, right: Type): number;
}
export declare const BooleanComparator: OrderComparator<boolean>;
export declare const NumberComparator: OrderComparator<number>;
export declare const StringComparator: OrderComparator<string>;
export declare function compareUsingEquals<Type extends SupportsEquals<Type>>(a: Type, b: Type): boolean;
export declare function arrayDeduplicate<Type>(arr: Type[], cmp?: EqualsComparator<Type>): Type[];
export declare function arrayEquals<Type>(left?: Type[], right?: Type[], cmp?: EqualsComparator<Type>): boolean;
export declare function arrayEqualsIgnoreOrdering<Type>(left?: Type[], right?: Type[], cmp?: EqualsComparator<Type>): boolean;
export declare function arrayCountEqualElements<Type>(left?: Type[], right?: Type[], cmp?: EqualsComparator<Type>): number;
export declare function arrayMin<Type>(arr: Type[], cmp: OrderComparator<Type>): Type;
export declare function arrayMax<Type>(arr: Type[], cmp: OrderComparator<Type>): Type;
export declare function arrayContains<Type>(arr: Type[], toFind: Type, cmp?: EqualsComparator<Type>): boolean;
export declare function checkInteger(arg: number, argName: string): void;
export declare function findInIterable<T>(iterable: IterableIterator<T>, predicate: (value: T) => boolean): T | undefined;
export declare function isNullish(val: unknown): boolean;
export declare const ONE: Decimal;
export declare const ZERO: Decimal;
export {};
//# sourceMappingURL=utils.d.ts.map