Huge News!Announcing our $40M Series B led by Abstract Ventures.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.1.1 to 6.1.2

lib/index.es.js

47

lib/index.js

@@ -318,3 +318,3 @@ 'use strict';

var paths = rootToLeaf(tree);
var maybeStem = {};
var stemmedRevs;

@@ -327,11 +327,23 @@ var result;

var stemmed = path.ids;
var numStemmed = Math.max(0, stemmed.length - depth);
var stemmedNode = {
pos: path.pos + numStemmed,
ids: pathToTree(stemmed, numStemmed)
};
var node;
if (stemmed.length > depth) {
// only do the stemming work if we actually need to stem
if (!stemmedRevs) {
stemmedRevs = {}; // avoid allocating this object unnecessarily
}
var numStemmed = stemmed.length - depth;
node = {
pos: path.pos + numStemmed,
ids: pathToTree(stemmed, numStemmed)
};
for (var s = 0; s < numStemmed; s++) {
var rev = (path.pos + s) + '-' + stemmed[s].id;
maybeStem[rev] = true;
for (var s = 0; s < numStemmed; s++) {
var rev = (path.pos + s) + '-' + stemmed[s].id;
stemmedRevs[rev] = true;
}
} else { // no need to actually stem
node = {
pos: path.pos,
ids: pathToTree(stemmed, 0)
};
}

@@ -342,16 +354,19 @@

if (result) {
result = doMerge(result, stemmedNode, true).tree;
result = doMerge(result, node, true).tree;
} else {
result = [stemmedNode];
result = [node];
}
}
traverseRevTree(result, function (isLeaf, pos, revHash) {
// some revisions may have been removed in a branch but not in another
delete maybeStem[pos + '-' + revHash];
});
// this is memory-heavy per Chrome profiler, avoid unless we actually stemmed
if (stemmedRevs) {
traverseRevTree(result, function (isLeaf, pos, revHash) {
// some revisions may have been removed in a branch but not in another
delete stemmedRevs[pos + '-' + revHash];
});
}
return {
tree: result,
revs: Object.keys(maybeStem)
revs: stemmedRevs ? Object.keys(stemmedRevs) : []
};

@@ -358,0 +373,0 @@ }

{
"name": "pouchdb-merge",
"version": "6.1.1",
"version": "6.1.2",
"description": "PouchDB's document merge algorithm.",

@@ -10,8 +10,9 @@ "main": "./lib/index.js",

"repository": "https://github.com/pouchdb/pouchdb",
"jsnext:main": "./src/index.js",
"jsnext:main": "./lib/index.es.js",
"dependencies": {},
"files": [
"lib",
"src"
],
"dependencies": {}
"dist",
"tonic-example.js"
]
}
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