INNER CODE UNIT · JavaScript

_pushMap

mongoosejs/mquery · lib/mquery.js:1313

function _pushMap(opts, map) {
  opts.sort = opts.sort || new Map();
  if (!(opts.sort instanceof Map)) {
    throw new TypeError('Can\'t mix sort syntaxes. Use either array or ' +
      'object or map consistently');
  }
  map.forEach(function(value, key) {
    let val = String(value || 1).toLowerCase();
    val = _validSortValue[val];
    if (!val) throw new TypeError('Invalid sort value: < ' + key + ': ' + value + ' >');

    opts.sort.set(key, val);
  });
}


/**
 * Specifies the limit option.

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…