MCPcopy
hub / github.com/apache/pouchdb / revExists

Function revExists

lib/index.js:1225–1242  ·  view source on GitHub ↗
(revs, rev)

Source from the content-addressed store, hash-verified

1223
1224// return true if a rev exists in the rev tree, false otherwise
1225function revExists(revs, rev) {
1226 var toVisit = revs.slice();
1227 var splitRev = rev.split('-');
1228 var targetPos = parseInt(splitRev[0], 10);
1229 var targetId = splitRev[1];
1230
1231 var node;
1232 while ((node = toVisit.pop())) {
1233 if (node.pos === targetPos && node.ids[0] === targetId) {
1234 return true;
1235 }
1236 var branches = node.ids[2];
1237 for (var i = 0, len = branches.length; i < len; i++) {
1238 toVisit.push({pos: node.pos + 1, ids: branches[i]});
1239 }
1240 }
1241 return false;
1242}
1243
1244function getTrees(node) {
1245 return node.ids;

Callers 1

updateDocFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…