mingo
Version:
MongoDB query language for in-memory objects
24 lines (23 loc) • 953 B
TypeScript
export type Any = unknown;
export type AnyObject = Record<string, Any>;
export type ArrayOrObject = AnyObject | Any[];
export interface Callback<R = Any, T = Any> {
(...args: T[]): R;
}
export interface Predicate<T = Any> {
(...args: T[]): boolean;
}
export interface Comparator<T = Any> {
(left: T, right: T): number;
}
/**
* Custom function to hash values to improve faster comparaisons
*/
export type HashFunction = (x: Any) => number;
type CommonTypes = "null" | "undefined" | "string" | "date" | "array" | "object";
export type JsType = CommonTypes | "boolean" | "number" | "string" | "regexp" | "function";
export type BsonType = CommonTypes | "bool" | "int" | "long" | "double" | "decimal" | "regex";
export declare const TIME_UNITS: readonly ["year", "quarter", "month", "week", "day", "hour", "minute", "second", "millisecond"];
/** Time unit for datetime periods */
export type TimeUnit = (typeof TIME_UNITS)[number];
export {};