INNER CODE UNIT · JavaScript
resolve
ramiel/mongoose-sequence · lib/sequence.js:9
const resolve = (path, obj) =>
path.split('.').reduce((prev, curr) => (prev ? prev[curr] : null), obj);
module.exports = function SequenceFactory(connection) {
if (arguments.length !== 1) {
throw new Error(
'Please, pass mongoose while requiring mongoose-sequence: https://github.com/ramiel/mongoose-sequence#requiring',
);
}
/**
* Sequence plugin constructor
* @class Sequence
* @param {string} schema the schema object
* @param {object} options A set of options for this plugin
* @param {string} [options.inc_field='_id'] The field to increment
* @param {string} [options.id='same as inc_field'] The id of this sequence.
* Mandatory only if the sequence use reference fields