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.11 to 0.0.12

2

lib/map.d.ts
import { TernaryTreeMap, TernaryTreeMapHashEntry } from "./types";
export declare function getMapDepth<K, V>(tree: TernaryTreeMap<K, V>): number;
export declare function initTernaryTreeMapFromHashEntries<K, T>(xs: Array<TernaryTreeMapHashEntry<K, T>>): TernaryTreeMap<K, T>;
export declare function initTernaryTreeMap<K, T>(t: Map<K, T>): TernaryTreeMap<K, T>;
export declare function initTernaryTreeMap<K, T>(t: Map<K, T> | Array<[K, T]>): TernaryTreeMap<K, T>;
export declare function initEmptyTernaryTreeMap<K, T>(): TernaryTreeMap<K, T>;

@@ -6,0 +6,0 @@ export declare function mapToString<K, V>(tree: TernaryTreeMap<K, V>): string;

@@ -157,6 +157,9 @@ import { TernaryTreeKind, hashGenerator } from "./types";

}
let xs = [...groupBuffers.keys()].sort(cmp).map((h) => {
let pairs = groupBuffers.get(h);
if (pairs != null) {
return { hash: h, pairs: pairs };
let xs = [];
for (let [k, v] of groupBuffers) {
if (v != null) {
xs.push({
hash: k,
pairs: v,
});
}

@@ -166,3 +169,5 @@ else {

}
});
}
// MUTABLE in-place sort
xs.sort((a, b) => cmp(a.hash, b.hash));
let result = initTernaryTreeMapFromHashEntries(xs);

@@ -169,0 +174,0 @@ // checkMapStructure(result);

@@ -19,5 +19,7 @@ import { hashGenerator } from "./types";

let data10 = initTernaryTreeMap(dict);
let data11 = initTernaryTreeMap(inList);
// echo data10
justDisplay(formatMapInline(data10), "((2:12 3:13 7:17) ((_ 9:19 _) (6:16 _ 5:15) (_ 1:11 _)) (8:18 0:10 4:14))");
check(deepEqual(toHashSortedPairs(data10), inList));
check(deepEqual(toHashSortedPairs(data11), inList));
check(contains(data10, "1") == true);

@@ -24,0 +26,0 @@ check(contains(data10, "11") == false);

{
"name": "@calcit/ternary-tree",
"version": "0.0.11",
"version": "0.0.12",
"main": "./lib/index.js",

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

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

export function initTernaryTreeMap<K, T>(t: Map<K, T>): TernaryTreeMap<K, T> {
export function initTernaryTreeMap<K, T>(t: Map<K, T> | Array<[K, T]>): TernaryTreeMap<K, T> {
let groupBuffers: Map<number, Array<[K, T]>> = new Map();

@@ -168,11 +168,17 @@ for (let [k, v] of t) {

let xs: Array<TernaryTreeMapHashEntry<K, T>> = [...groupBuffers.keys()].sort(cmp).map((h) => {
let pairs = groupBuffers.get(h);
if (pairs != null) {
return { hash: h, pairs: pairs };
let xs: Array<TernaryTreeMapHashEntry<K, T>> = [];
for (let [k, v] of groupBuffers) {
if (v != null) {
xs.push({
hash: k,
pairs: v,
});
} else {
throw new Error("Expected reference to paris");
}
});
}
// MUTABLE in-place sort
xs.sort((a, b) => cmp(a.hash, b.hash));
let result = initTernaryTreeMapFromHashEntries(xs);

@@ -179,0 +185,0 @@ // checkMapStructure(result);

@@ -44,2 +44,3 @@ import { hashGenerator } from "./types";

let data10 = initTernaryTreeMap<string, number>(dict);
let data11 = initTernaryTreeMap<string, number>(inList);

@@ -50,2 +51,3 @@ // echo data10

check(deepEqual(toHashSortedPairs(data10), inList));
check(deepEqual(toHashSortedPairs(data11), inList));

@@ -52,0 +54,0 @@ check(contains(data10, "1") == true);

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