UNPKG

mongo-relay-connection

Version:

Helper for building relay connection from mongoose. Support dynamic collection, but only for single (unique or non-unique) field sorting.

17 lines (14 loc) 368 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; /* * For getting the nested leaf object from path. * e.g. a={a:{b:{c:'nat'}}}, leaf(a, 'a.b.c') => 'nat' */ function leaf(object, path) { return path.split('.').reduce((value, key) => value[key], object); } var _default = leaf; exports.default = _default;