Comparing version 2.0.16 to 2.0.17
@@ -18,3 +18,3 @@ declare type Color = 0 | 1 | 2 | ||
high: number, | ||
callback: (index: number, low: number, high: number) => any | ||
callback: (index: number, low: number) => any | ||
): void | ||
@@ -21,0 +21,0 @@ size: number |
@@ -341,18 +341,19 @@ 'use strict' | ||
search(low, high, callback) { | ||
function searchRecursive(node) { | ||
const stack = [tree.root] | ||
while (stack.length !== 0) { | ||
const node = stack.pop() | ||
if (node === NULL_NODE || low > node.max) return | ||
if (node.left !== NULL_NODE) searchRecursive(node.left) | ||
if (node.left !== NULL_NODE) stack.push(node.left) | ||
if (node.right !== NULL_NODE) stack.push(node.right) | ||
if (node.low <= high && node.high >= low) { | ||
for (let i = 0; i < node.list.length; i++) { | ||
const index = node.list[i] | ||
const nodeHigh = node.list[++i] | ||
if (nodeHigh >= low) callback(index, node.low, nodeHigh) | ||
for (let i = 0, len = node.list.length; i < len; i++) { | ||
const index = node.list[i++] // normally we'd include the high bound here, too, but since we | ||
// don't need it in practice, it makes sense to just leave it out | ||
if (node.list[i] >= low) callback(index, node.low) | ||
} | ||
} | ||
if (node.right !== NULL_NODE) searchRecursive(node.right) | ||
} | ||
searchRecursive(tree.root) | ||
}, | ||
@@ -359,0 +360,0 @@ |
@@ -18,3 +18,3 @@ declare type Color = 0 | 1 | 2 | ||
high: number, | ||
callback: (index: number, low: number, high: number) => any | ||
callback: (index: number, low: number) => any | ||
): void | ||
@@ -21,0 +21,0 @@ size: number |
@@ -337,18 +337,19 @@ const RED = 0 | ||
search(low, high, callback) { | ||
function searchRecursive(node) { | ||
const stack = [tree.root] | ||
while (stack.length !== 0) { | ||
const node = stack.pop() | ||
if (node === NULL_NODE || low > node.max) return | ||
if (node.left !== NULL_NODE) searchRecursive(node.left) | ||
if (node.left !== NULL_NODE) stack.push(node.left) | ||
if (node.right !== NULL_NODE) stack.push(node.right) | ||
if (node.low <= high && node.high >= low) { | ||
for (let i = 0; i < node.list.length; i++) { | ||
const index = node.list[i] | ||
const nodeHigh = node.list[++i] | ||
if (nodeHigh >= low) callback(index, node.low, nodeHigh) | ||
for (let i = 0, len = node.list.length; i < len; i++) { | ||
const index = node.list[i++] // normally we'd include the high bound here, too, but since we | ||
// don't need it in practice, it makes sense to just leave it out | ||
if (node.list[i] >= low) callback(index, node.low) | ||
} | ||
} | ||
if (node.right !== NULL_NODE) searchRecursive(node.right) | ||
} | ||
searchRecursive(tree.root) | ||
}, | ||
@@ -355,0 +356,0 @@ |
{ | ||
"name": "masonic", | ||
"version": "2.0.16", | ||
"version": "2.0.17", | ||
"homepage": "https://github.com/jaredLunde/masonic#readme", | ||
@@ -34,2 +34,3 @@ "repository": "github:jaredLunde/masonic", | ||
"scripts": { | ||
"bench": "babel-node ./benchmarks --extensions \".ts\"", | ||
"build": "npm run build:cjs && npm run build:es && npm run build:types", | ||
@@ -61,3 +62,5 @@ "build:cjs": "babel src -d dist/cjs -x .ts,.tsx --ignore \"**/*.test.ts\",\"**/test.ts\",\"**/*.test.tsx\",\"**/test.tsx\" --delete-dir-on-start", | ||
"devDependencies": { | ||
"@babel/node": "^7.7.4", | ||
"@babel/preset-react": "latest", | ||
"@essentials/benchmark": "^1.0.5", | ||
"@lunde/babel-preset-es": "latest", | ||
@@ -84,2 +87,3 @@ "@testing-library/jest-dom": "latest", | ||
"prettier": "latest", | ||
"rand-int": "^1.0.0", | ||
"react": "latest", | ||
@@ -86,0 +90,0 @@ "react-dom": "latest", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
93419
2531
31