Socket
Socket
Sign inDemoInstall

sorted-btree

Package Overview
Dependencies
0
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.0.1

16

b+tree.js

@@ -355,3 +355,3 @@ // B+ tree by David Piepgrass. License: MIT

BTree.prototype.findPath = function (key) {
var nextnode = this._root, height = this.height;
var nextnode = this._root;
var nodequeue, nodeindex;

@@ -377,3 +377,3 @@ if (nextnode.isLeaf) {

BTree.prototype.keys = function (firstKey) {
var it = this.entries(firstKey, ReusedArray), n;
var it = this.entries(firstKey, ReusedArray);
return iterator(function () {

@@ -388,3 +388,3 @@ var n = it.next();

BTree.prototype.values = function (firstKey) {
var it = this.entries(firstKey, ReusedArray), n;
var it = this.entries(firstKey, ReusedArray);
return iterator(function () {

@@ -749,9 +749,9 @@ var n = it.next();

if (this.values === undefVals) {
while (undefVals.length < tree._maxNodeSize)
undefVals.push(undefined);
if (value === undefined) {
while (undefVals.length < tree._maxNodeSize)
undefVals.push(undefined);
return true;
}
else {
this.values = new Array(this.keys.length - 1);
this.values = undefVals.slice(0, this.keys.length - 1);
}

@@ -866,4 +866,4 @@ }

if (!keys) {
keys = new Array(children.length);
for (var i = 0; i < keys.length; i++)
keys = [];
for (var i = 0; i < children.length; i++)
keys[i] = children[i].maxKey();

@@ -870,0 +870,0 @@ }

{
"name": "sorted-btree",
"version": "1.0.0",
"version": "1.0.1",
"description": "A list of key-value pairs kept sorted in a fast in-memory B+ tree with a powerful API, similar to Map.",
"main": "b+tree.js",
"scripts": {
"test": "jest",
"build": "tsc",
"test": "tsc && jest",
"build": "tsc && npm run minify",
"minify": "uglifyjs -cm -o b+tree.min.js -- b+tree.js",
"prepare": "npm run build",
"safePublish": "testpack && npm publish"
"safePublish": "npm run build && testpack && npm publish"
},

@@ -45,5 +46,6 @@ "files": [

"mersenne-twister": "^1.1.0",
"testpack-cli": "^1.1.1",
"testpack-cli": "^1.1.2",
"ts-jest": "^22.4.6",
"typescript": "^2.9.2"
"typescript": "^2.9.2",
"uglifyjs": "^2.4.11"
},

@@ -55,5 +57,6 @@ "dependencies": {},

},
"testRegex": "(/tests/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
"testRegex": "(/tests/.*|(\\.|/)test)\\.(jsx?|tsx?)$",
"testPathIgnorePatterns": [
"<rootDir>.*nontest.*"
"<rootDir>.*nontest.*",
"<rootDir>/.testpack"
],

@@ -80,4 +83,12 @@ "moduleFileExtensions": [

"verbose": true,
"test-folder": ".testpack"
"test-folder": ".testpack",
"rmdir": true,
"dirty": true,
"replace-import//": "// Use the minified version in .testpack",
"replace-import": [
"|./b+tree|$P/b+tree.min|",
"|..?|$P|",
"|..?([/\\\\].*)|$P$1|"
]
}
}

@@ -6,7 +6,7 @@ B+ tree

This is a fast B+ tree implementation, largely compatible with the standard Map, but with a much more diverse and powerful API. To use it, `import BTree<K,V> from 'sorted-btree'`.
This is a fast B+ tree implementation, largely compatible with the standard Map, but with a much more diverse and powerful API. To use it, `import BTree from 'sorted-btree'`.
### Features ###
- Requires ES5 only (Symbol.iterator is not required but is used if defined.)
- Requires ES5 only (`Symbol.iterator` is not required but is used if defined.)
- Supports a custom comparator, which must be passed to the constructor.

@@ -17,3 +17,3 @@ - Supports O(1) fast cloning with subtree sharing. This works by marking the

- API similar to `Map<K,V>` with methods such as `size(), clear()`,
`foreach((k,v,tree)=>void), get(K), set(K,V), has(K), delete(K)`,
`forEach((v,k,tree)=>{}), get(K), set(K,V), has(K), delete(K)`,
plus iterator functions `keys()`, `values()` and `entries()`.

@@ -26,3 +26,2 @@ - For efficiency, when a node fills up, items are shifted to siblings when

- Includes neat stuff such as `Range` methods for batch operations
- Duplicate keys are not allowed (supporting duplicates properly is complex).
- Throws an exception if you try to use `NaN` as a key, but infinity is allowed.

@@ -49,2 +48,4 @@

**Note:** Duplicate keys are not allowed (supporting duplicates properly is complex).
The "scanning" methods (`forEach, forRange, editRange, deleteRange`) will normally return the number of elements that were scanned. However, the callback can return `{break:R}` to stop iterating early and return a value `R` from the scanning method.

@@ -51,0 +52,0 @@

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc