UNPKG

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) 2.89 kB
"use strict";var __extends=this&&this.__extends||function(){var o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)};return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),__createBinding=this&&this.__createBinding||(Object.create?function(t,e,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(e,r);n&&("get"in n?e.__esModule:!n.writable&&!n.configurable)||(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,o,n)}:function(t,e,r,o){void 0===o&&(o=r),t[o]=e[r]}),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),__importStar=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&__createBinding(e,t,r);return __setModuleDefault(e,t),e},__importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.BTreeEx=void 0;var b_tree_1=__importStar(require("../b+tree")),diffAgainst_1=__importDefault(require("./diffAgainst")),forEachKeyInBoth_1=__importDefault(require("./forEachKeyInBoth")),forEachKeyNotIn_1=__importDefault(require("./forEachKeyNotIn")),intersect_1=__importDefault(require("./intersect")),subtract_1=__importDefault(require("./subtract")),union_1=__importDefault(require("./union")),bulkLoad_1=require("./bulkLoad"),BTreeEx=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.bulkLoad=function(t,e,r,o){o=null!=o?o:b_tree_1.defaultComparator,e=(0,bulkLoad_1.bulkLoadRoot)(t,e,r,o),r=new n(void 0,o,r);return r._root=e,r},n.prototype.clone=function(){this._root.isShared=!0;var t=new n(void 0,this._compare,this._maxNodeSize);return t._root=this._root,t},n.prototype.greedyClone=function(t){var e=new n(void 0,this._compare,this._maxNodeSize);return e._root=this._root.greedyClone(t),e},n.prototype.diffAgainst=function(t,e,r,o){return(0,diffAgainst_1.default)(this,t,e,r,o)},n.prototype.forEachKeyInBoth=function(t,e){return(0,forEachKeyInBoth_1.default)(this,t,e)},n.prototype.forEachKeyNotIn=function(t,e){return(0,forEachKeyNotIn_1.default)(this,t,e)},n.prototype.intersect=function(t,e){return(0,intersect_1.default)(this,t,e)},n.prototype.union=function(t,e){return(0,union_1.default)(this,t,e)},n.prototype.subtract=function(t){return(0,subtract_1.default)(this,t)},n}(b_tree_1.default);exports.BTreeEx=BTreeEx,exports.default=BTreeEx;