UNPKG

mingo

Version:

MongoDB query language for in-memory objects

10 lines (9 loc) 279 B
import { ComputeOptions, evalExpr } from "../../core/_internal"; const $last = (coll, expr, options) => { const obj = coll[coll.length - 1]; const copts = ComputeOptions.init(options).update({ root: obj }); return evalExpr(obj, expr, copts) ?? null; }; export { $last };