New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@calcit/ternary-tree

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@calcit/ternary-tree - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

142

lib/map.js

@@ -310,14 +310,38 @@ import { TernaryTreeKind, hashGenerator } from "./types";

// echo "looking for: ", hx, " ", item, " in ", tree.formatInline(true)
for (let branch of [tree.left, tree.middle, tree.right]) {
if (branch != null) {
if (branch.kind === TernaryTreeKind.ternaryTreeLeaf) {
if (branch.hash === hx) {
if (tree.left != null) {
if (tree.left != null) {
if (tree.left.kind === TernaryTreeKind.ternaryTreeLeaf) {
if (tree.left.hash === hx) {
return true;
}
}
else if (hx >= branch.minHash && hx <= branch.maxHash) {
return contains(branch, item, hx); // TODO
else if (hx >= tree.left.minHash && hx <= tree.left.maxHash) {
return contains(tree.left, item, hx); // TODO
}
}
}
if (tree.middle != null) {
if (tree.middle != null) {
if (tree.middle.kind === TernaryTreeKind.ternaryTreeLeaf) {
if (tree.middle.hash === hx) {
return true;
}
}
else if (hx >= tree.middle.minHash && hx <= tree.middle.maxHash) {
return contains(tree.middle, item, hx); // TODO
}
}
}
if (tree.right != null) {
if (tree.right != null) {
if (tree.right.kind === TernaryTreeKind.ternaryTreeLeaf) {
if (tree.right.hash === hx) {
return true;
}
}
else if (hx >= tree.right.minHash && hx <= tree.right.maxHash) {
return contains(tree.right, item, hx); // TODO
}
}
}
return false;

@@ -338,20 +362,50 @@ }

// echo "looking for: ", hx, " ", item, " in ", tree.formatInline
for (let branch of [tree.left, tree.middle, tree.right]) {
if (branch != null) {
if (branch.kind == TernaryTreeKind.ternaryTreeLeaf) {
if (branch.hash === hx) {
for (let pair of branch.elements) {
if (dataEqual(pair[0], item)) {
return pair[1];
}
if (tree.left != null) {
if (tree.left.kind == TernaryTreeKind.ternaryTreeLeaf) {
if (tree.left.hash === hx) {
for (let pair of tree.left.elements) {
if (dataEqual(pair[0], item)) {
return pair[1];
}
return nilResult;
}
return nilResult;
}
else if (hx >= branch.minHash && hx <= branch.maxHash) {
tree = branch;
continue whileLoop; // notice, it jumps to while loop
}
else if (hx >= tree.left.minHash && hx <= tree.left.maxHash) {
tree = tree.left;
continue whileLoop; // notice, it jumps to while loop
}
}
if (tree.middle != null) {
if (tree.middle.kind == TernaryTreeKind.ternaryTreeLeaf) {
if (tree.middle.hash === hx) {
for (let pair of tree.middle.elements) {
if (dataEqual(pair[0], item)) {
return pair[1];
}
}
return nilResult;
}
}
else if (hx >= tree.middle.minHash && hx <= tree.middle.maxHash) {
tree = tree.middle;
continue whileLoop; // notice, it jumps to while loop
}
}
if (tree.right != null) {
if (tree.right.kind == TernaryTreeKind.ternaryTreeLeaf) {
if (tree.right.hash === hx) {
for (let pair of tree.right.elements) {
if (dataEqual(pair[0], item)) {
return pair[1];
}
}
return nilResult;
}
}
else if (hx >= tree.right.minHash && hx <= tree.right.maxHash) {
tree = tree.right;
continue whileLoop; // notice, it jumps to while loop
}
}
return nilResult;

@@ -892,5 +946,11 @@ }

else {
for (let branch of [tree.left, tree.middle, tree.right]) {
collectToPairsArray(acc, branch);
if (tree.left != null) {
collectToPairsArray(acc, tree.left);
}
if (tree.middle != null) {
collectToPairsArray(acc, tree.middle);
}
if (tree.right != null) {
collectToPairsArray(acc, tree.right);
}
}

@@ -913,7 +973,17 @@ }

else {
for (let branch of [tree.left, tree.middle, tree.right]) {
for (let item of toPairs(branch)) {
if (tree.left != null) {
for (let item of toPairs(tree.left)) {
yield item;
}
}
if (tree.middle != null) {
for (let item of toPairs(tree.middle)) {
yield item;
}
}
if (tree.right != null) {
for (let item of toPairs(tree.right)) {
yield item;
}
}
}

@@ -930,7 +1000,17 @@ }

else {
for (let branch of [tree.left, tree.middle, tree.right]) {
for (let item of toKeys(branch)) {
if (tree.left != null) {
for (let item of toKeys(tree.left)) {
yield item;
}
}
if (tree.middle != null) {
for (let item of toKeys(tree.middle)) {
yield item;
}
}
if (tree.right != null) {
for (let item of toKeys(tree.right)) {
yield item;
}
}
}

@@ -947,7 +1027,17 @@ }

else {
for (let branch of [tree.left, tree.middle, tree.right]) {
for (let item of toValues(branch)) {
if (tree.left != null) {
for (let item of toValues(tree.left)) {
yield item;
}
}
if (tree.middle != null) {
for (let item of toValues(tree.middle)) {
yield item;
}
}
if (tree.right != null) {
for (let item of toValues(tree.right)) {
yield item;
}
}
}

@@ -954,0 +1044,0 @@ }

2

package.json
{
"name": "@calcit/ternary-tree",
"version": "0.0.5",
"version": "0.0.6",
"main": "./lib/index.js",

@@ -5,0 +5,0 @@ "devDependencies": {

@@ -331,13 +331,35 @@ import { TernaryTreeMap, TernaryTreeKind, TernaryTreeMapTheLeaf, TernaryTreeMapTheBranch, RefInt, Hash, hashGenerator, TernaryTreeMapHashEntry } from "./types";

// echo "looking for: ", hx, " ", item, " in ", tree.formatInline(true)
for (let branch of [tree.left, tree.middle, tree.right]) {
if (branch != null) {
if (branch.kind === TernaryTreeKind.ternaryTreeLeaf) {
if (branch.hash === hx) {
if (tree.left != null) {
if (tree.left != null) {
if (tree.left.kind === TernaryTreeKind.ternaryTreeLeaf) {
if (tree.left.hash === hx) {
return true;
}
} else if (hx >= branch.minHash && hx <= branch.maxHash) {
return contains(branch, item, hx); // TODO
} else if (hx >= tree.left.minHash && hx <= tree.left.maxHash) {
return contains(tree.left, item, hx); // TODO
}
}
}
if (tree.middle != null) {
if (tree.middle != null) {
if (tree.middle.kind === TernaryTreeKind.ternaryTreeLeaf) {
if (tree.middle.hash === hx) {
return true;
}
} else if (hx >= tree.middle.minHash && hx <= tree.middle.maxHash) {
return contains(tree.middle, item, hx); // TODO
}
}
}
if (tree.right != null) {
if (tree.right != null) {
if (tree.right.kind === TernaryTreeKind.ternaryTreeLeaf) {
if (tree.right.hash === hx) {
return true;
}
} else if (hx >= tree.right.minHash && hx <= tree.right.maxHash) {
return contains(tree.right, item, hx); // TODO
}
}
}

@@ -364,19 +386,47 @@ return false;

for (let branch of [tree.left, tree.middle, tree.right]) {
if (branch != null) {
if (branch.kind == TernaryTreeKind.ternaryTreeLeaf) {
if (branch.hash === hx) {
for (let pair of branch.elements) {
if (dataEqual(pair[0], item)) {
return pair[1];
}
if (tree.left != null) {
if (tree.left.kind == TernaryTreeKind.ternaryTreeLeaf) {
if (tree.left.hash === hx) {
for (let pair of tree.left.elements) {
if (dataEqual(pair[0], item)) {
return pair[1];
}
return nilResult;
}
} else if (hx >= branch.minHash && hx <= branch.maxHash) {
tree = branch;
continue whileLoop; // notice, it jumps to while loop
return nilResult;
}
} else if (hx >= tree.left.minHash && hx <= tree.left.maxHash) {
tree = tree.left;
continue whileLoop; // notice, it jumps to while loop
}
}
if (tree.middle != null) {
if (tree.middle.kind == TernaryTreeKind.ternaryTreeLeaf) {
if (tree.middle.hash === hx) {
for (let pair of tree.middle.elements) {
if (dataEqual(pair[0], item)) {
return pair[1];
}
}
return nilResult;
}
} else if (hx >= tree.middle.minHash && hx <= tree.middle.maxHash) {
tree = tree.middle;
continue whileLoop; // notice, it jumps to while loop
}
}
if (tree.right != null) {
if (tree.right.kind == TernaryTreeKind.ternaryTreeLeaf) {
if (tree.right.hash === hx) {
for (let pair of tree.right.elements) {
if (dataEqual(pair[0], item)) {
return pair[1];
}
}
return nilResult;
}
} else if (hx >= tree.right.minHash && hx <= tree.right.maxHash) {
tree = tree.right;
continue whileLoop; // notice, it jumps to while loop
}
}

@@ -931,5 +981,11 @@ return nilResult;

} else {
for (let branch of [tree.left, tree.middle, tree.right]) {
collectToPairsArray(acc, branch);
if (tree.left != null) {
collectToPairsArray(acc, tree.left);
}
if (tree.middle != null) {
collectToPairsArray(acc, tree.middle);
}
if (tree.right != null) {
collectToPairsArray(acc, tree.right);
}
}

@@ -953,7 +1009,17 @@ }

} else {
for (let branch of [tree.left, tree.middle, tree.right]) {
for (let item of toPairs(branch)) {
if (tree.left != null) {
for (let item of toPairs(tree.left)) {
yield item;
}
}
if (tree.middle != null) {
for (let item of toPairs(tree.middle)) {
yield item;
}
}
if (tree.right != null) {
for (let item of toPairs(tree.right)) {
yield item;
}
}
}

@@ -970,7 +1036,17 @@ }

} else {
for (let branch of [tree.left, tree.middle, tree.right]) {
for (let item of toKeys(branch)) {
if (tree.left != null) {
for (let item of toKeys(tree.left)) {
yield item;
}
}
if (tree.middle != null) {
for (let item of toKeys(tree.middle)) {
yield item;
}
}
if (tree.right != null) {
for (let item of toKeys(tree.right)) {
yield item;
}
}
}

@@ -987,7 +1063,17 @@ }

} else {
for (let branch of [tree.left, tree.middle, tree.right]) {
for (let item of toValues(branch)) {
if (tree.left != null) {
for (let item of toValues(tree.left)) {
yield item;
}
}
if (tree.middle != null) {
for (let item of toValues(tree.middle)) {
yield item;
}
}
if (tree.right != null) {
for (let item of toValues(tree.right)) {
yield item;
}
}
}

@@ -994,0 +1080,0 @@ }

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc