How to use the pouchdb-merge.collectLeaves function in pouchdb-merge

To help you get started, we’ve selected a few pouchdb-merge 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-core / src / adapter.js View on Github external
this._getRevisionTree(id, function (err, rev_tree) {
        /* istanbul ignore if */
        if (err) {
          return cb(err);
        }
        leaves = collectLeaves(rev_tree).map(function (leaf) {
          return leaf.rev;
        });
        finishOpenRevs();
      });
    } else {
github pouchdb / pouchdb / packages / node_modules / pouchdb-core / src / adapter.js View on Github external
this._getRevisionTree(id, function (err, rev_tree) {
        if (err) {
          return cb(err);
        }
        leaves = collectLeaves(rev_tree).map(function (leaf) {
          return leaf.rev;
        });
        finishOpenRevs();
      });
    } else {
github pouchdb / pouchdb / packages / node_modules / pouchdb-core / src / changes.js View on Github external
function processChange(doc, metadata, opts) {
  var changeList = [{rev: doc._rev}];
  if (opts.style === 'all_docs') {
    changeList = collectLeaves(metadata.rev_tree)
    .map(function (x) { return {rev: x.rev}; });
  }
  var change = {
    id: metadata.id,
    changes: changeList,
    doc: doc
  };

  if (isDeleted(metadata, doc._rev)) {
    change.deleted = true;
  }
  if (opts.conflicts) {
    change.doc._conflicts = collectConflicts(metadata);
    if (!change.doc._conflicts.length) {
      delete change.doc._conflicts;
    }

pouchdb-merge

PouchDB's document merge algorithm.

Apache-2.0
Latest version published 6 months ago

Package Health Score

82 / 100
Full package analysis

Similar packages