sorted-btree
Version:
A sorted list of key-value pairs in a fast, typed in-memory B+ tree with a powerful API.
2 lines (1 loc) • 1.26 kB
JavaScript
;Object.defineProperty(exports,"__esModule",{value:!0});var shared_1=require("./shared"),parallelWalk_1=require("./parallelWalk");function forEachKeyNotIn(l,a,e){var r=l,o=a;if((0,shared_1.checkCanDoSetOperation)(r,o,!0),0!==l.size){var p=function(){do{var l=(0,parallelWalk_1.getKey)(n),a=n.leaf.values[n.leafIndex],a=e(l,a);if(a&&a.break)return a.break}while(!(0,parallelWalk_1.moveForwardOne)(n,_))},k=l._compare,l=function(){},n=(0,parallelWalk_1.createCursor)(r,l,parallelWalk_1.noop,parallelWalk_1.noop,parallelWalk_1.noop,parallelWalk_1.noop,parallelWalk_1.noop);if(0===a.size)return p();for(var _=(0,parallelWalk_1.createCursor)(o,l,parallelWalk_1.noop,parallelWalk_1.noop,parallelWalk_1.noop,parallelWalk_1.noop,parallelWalk_1.noop),t=k((0,parallelWalk_1.getKey)(n),(0,parallelWalk_1.getKey)(_));;){var W=0===t;if(W){if((0,parallelWalk_1.moveForwardOne)(n,_))break;t=1}else if(t<0){var f=(0,parallelWalk_1.getKey)(n),i=n.leaf.values[n.leafIndex],i=e(f,i);if(i&&i.break)return i.break;if((0,parallelWalk_1.moveForwardOne)(n,_))break;t=k((0,parallelWalk_1.getKey)(n),(0,parallelWalk_1.getKey)(_))}else{i=(0,parallelWalk_1.moveTo)(_,n,(0,parallelWalk_1.getKey)(n),!0,W),W=i[0],i=i[1];if(W)return p();t=i?0:-1}}}}exports.default=forEachKeyNotIn;