UNPKG

mingo

Version:

MongoDB query language for in-memory objects

10 lines (9 loc) 293 B
import { ComputeOptions, computeValue } from "../../core/_internal"; const $first = (collection, expr, options) => { const obj = collection[0]; const copts = ComputeOptions.init(options).update({ root: obj }); return computeValue(obj, expr, null, copts) ?? null; }; export { $first };