@signaldb/core
Version:
SignalDB is a client-side database that provides a simple MongoDB-like interface to the data with first-class typescript support to achieve an optimistic UI. Data persistence can be achieved by using storage providers that store the data through a JSON in
16 lines (15 loc) • 533 B
JavaScript
import { Query } from "mingo";
//#region src/utils/match.ts
/**
* Tests whether a given item matches a specified selector.
* Uses the `mingo` library to evaluate the query.
* @template T - The type of the item being tested.
* @param item - The item to test against the selector.
* @param selector - The query selector used to match the item.
* @returns A boolean indicating whether the item matches the selector.
*/
function match(item, selector) {
return new Query(selector).test(item);
}
//#endregion
export { match as default };