New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

pouchdb-merge

Package Overview
Dependencies
Maintainers
3
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pouchdb-merge - npm Package Compare versions

Comparing version 6.0.7 to 6.1.0

src/latest.js

39

lib/index.js

@@ -414,2 +414,38 @@ 'use strict';

// returns the current leaf node for a given revision
function latest(rev, metadata) {
var toVisit = metadata.rev_tree.slice();
var node;
while ((node = toVisit.pop())) {
var pos = node.pos;
var tree = node.ids;
var id = tree[0];
var opts = tree[1];
var branches = tree[2];
var isLeaf = branches.length === 0;
var history = node.history ? node.history.slice() : [];
history.push({id: id, pos: pos, opts: opts});
if (isLeaf) {
for (var i = 0, len = history.length; i < len; i++) {
var historyNode = history[i];
var historyRev = historyNode.pos + '-' + historyNode.id;
if (historyRev === rev) {
// return the rev of this leaf
return pos + '-' + id;
}
}
}
for (var j = 0, l = branches.length; j < l; j++) {
toVisit.push({pos: pos + 1, ids: branches[j], history: history});
}
}
/* istanbul ignore next */
throw new Error('Unable to resolve latest revision for id ' + metadata.id + ', rev ' + rev);
}
exports.collectConflicts = collectConflicts;

@@ -424,2 +460,3 @@ exports.collectLeaves = collectLeaves;

exports.traverseRevTree = traverseRevTree;
exports.winningRev = winningRev;
exports.winningRev = winningRev;
exports.latest = latest;

2

package.json
{
"name": "pouchdb-merge",
"version": "6.0.7",
"version": "6.1.0",
"description": "PouchDB's document merge algorithm.",

@@ -5,0 +5,0 @@ "main": "./lib/index.js",

@@ -11,2 +11,3 @@ import collectConflicts from './collectConflicts';

import isLocalId from './isLocalId';
import latest from './latest';

@@ -23,3 +24,4 @@ export {

traverseRevTree,
winningRev
winningRev,
latest
};
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc