@future-widget-lab/record-set
Version:
A dedicated data structure for in-memory record collections, offering fluent, immutable APIs for MongoDB-like querying, sorting, and transformation.
16 lines (15 loc) • 464 B
TypeScript
import type { Query } from 'sift';
type FindOneOptions<TRecord> = {
query?: Query<TRecord>;
records: Array<TRecord>;
};
/**
* @description
* Use this helper to find the first matching record given a query.
*
* Defaults to the first element if no `query` is provided.
*
* Fallbacks to `null` if the query provided does not return any matches.
*/
export declare const findOne: <TRecord>(options: FindOneOptions<TRecord>) => TRecord | null;
export {};