How to use the pouchdb-selector-core.compare function in pouchdb-selector-core

To help you get started, we’ve selected a few pouchdb-selector-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pouchdb / pouchdb / packages / node_modules / pouchdb-find / src / adapters / local / get-indexes / index.js View on Github external
res.indexes.sort(function (left, right) {
      return compare(left.name, right.name);
    });
    res.total_rows = res.indexes.length;
github pouchdb / pouchdb / packages / node_modules / pouchdb-find / src / adapters / local / find / query-planner.js View on Github external
return userFields.slice().sort(function (a, b) {
    var aIdx = indexFields.indexOf(a);
    var bIdx = indexFields.indexOf(b);
    if (aIdx === -1) {
      aIdx = Number.MAX_VALUE;
    }
    if (bIdx === -1) {
      bIdx = Number.MAX_VALUE;
    }
    return compare(aIdx, bIdx);
  });
}