@thi.ng/associative
Advanced tools
Comparing version 6.3.59 to 6.3.60
@@ -8,4 +8,3 @@ var __defProp = Object.defineProperty; | ||
result = (kind ? decorator(target, key, result) : decorator(result)) || result; | ||
if (kind && result) | ||
__defProp(target, key, result); | ||
if (kind && result) __defProp(target, key, result); | ||
return result; | ||
@@ -12,0 +11,0 @@ }; |
@@ -139,4 +139,3 @@ import { isString } from "@thi.ng/checks/is-string"; | ||
deleteAll(keys) { | ||
for (let k of keys) | ||
this.delete(k); | ||
for (let k of keys) this.delete(k); | ||
} | ||
@@ -149,4 +148,3 @@ /** | ||
deleteAllIDs(ids) { | ||
for (let id of ids) | ||
this.deleteID(id); | ||
for (let id of ids) this.deleteID(id); | ||
} | ||
@@ -167,4 +165,3 @@ /** | ||
if (id === void 0) { | ||
if (fail) | ||
throw new Error(`unknown key: ${k}`); | ||
if (fail) throw new Error(`unknown key: ${k}`); | ||
} else { | ||
@@ -191,4 +188,3 @@ res.push(id); | ||
if (k === void 0) { | ||
if (fail) | ||
throw new Error(`unknwon ID: ${id}`); | ||
if (fail) throw new Error(`unknwon ID: ${id}`); | ||
} else { | ||
@@ -195,0 +191,0 @@ res.push(k); |
# Change Log | ||
- **Last updated**: 2024-04-23T07:02:17Z | ||
- **Last updated**: 2024-05-08T18:24:31Z | ||
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub) | ||
@@ -5,0 +5,0 @@ |
@@ -8,4 +8,3 @@ var __defProp = Object.defineProperty; | ||
result = (kind ? decorator(target, key, result) : decorator(result)) || result; | ||
if (kind && result) | ||
__defProp(target, key, result); | ||
if (kind && result) __defProp(target, key, result); | ||
return result; | ||
@@ -12,0 +11,0 @@ }; |
@@ -8,4 +8,3 @@ var __defProp = Object.defineProperty; | ||
result = (kind ? decorator(target, key, result) : decorator(result)) || result; | ||
if (kind && result) | ||
__defProp(target, key, result); | ||
if (kind && result) __defProp(target, key, result); | ||
return result; | ||
@@ -24,4 +23,3 @@ }; | ||
for (let p of __private.get(map2).bins) { | ||
if (p) | ||
yield p[id]; | ||
if (p) yield p[id]; | ||
} | ||
@@ -61,4 +59,3 @@ }; | ||
for (let p of __private.get(this).bins) { | ||
if (p) | ||
yield [p[0], p[1]]; | ||
if (p) yield [p[0], p[1]]; | ||
} | ||
@@ -146,4 +143,3 @@ } | ||
j = j + 1 & mask; | ||
if (!bins[j]) | ||
return true; | ||
if (!bins[j]) return true; | ||
k = $this.hash(bins[j][0]) & mask; | ||
@@ -177,4 +173,3 @@ } while (i <= j ? i < k && k <= j : i < k || k <= j); | ||
i--; | ||
if (i < 0) | ||
return -1; | ||
if (i < 0) return -1; | ||
h = h + 1 & mask; | ||
@@ -191,4 +186,3 @@ } | ||
for (let p of src) { | ||
if (p) | ||
this.set(p[0], p[1]); | ||
if (p) this.set(p[0], p[1]); | ||
} | ||
@@ -195,0 +189,0 @@ } |
@@ -8,4 +8,3 @@ var __defProp = Object.defineProperty; | ||
result = (kind ? decorator(target, key, result) : decorator(result)) || result; | ||
if (kind && result) | ||
__defProp(target, key, result); | ||
if (kind && result) __defProp(target, key, result); | ||
return result; | ||
@@ -12,0 +11,0 @@ }; |
@@ -14,4 +14,3 @@ import { isFunction } from "@thi.ng/checks/is-function"; | ||
for (let k in xs) { | ||
if (isIllegalKey(k)) | ||
continue; | ||
if (isIllegalKey(k)) continue; | ||
const v = xs[k]; | ||
@@ -18,0 +17,0 @@ src[k] = isFunction(v) ? v(src[k]) : v; |
@@ -19,4 +19,3 @@ import { isIllegalKey } from "@thi.ng/checks/is-proto-path"; | ||
for (let k in x) { | ||
if (isIllegalKey(k)) | ||
continue; | ||
if (isIllegalKey(k)) continue; | ||
const v = x[k]; | ||
@@ -23,0 +22,0 @@ dest[k] = dest.hasOwnProperty(k) ? f(dest[k], v) : v; |
@@ -73,4 +73,3 @@ import { isArray } from "@thi.ng/checks/is-array"; | ||
node = node.next[key[i].toString()]; | ||
if (!node) | ||
return; | ||
if (!node) return; | ||
} | ||
@@ -91,4 +90,3 @@ return node; | ||
const next = node.next[k]; | ||
if (!next) | ||
break; | ||
if (!next) break; | ||
prefix.push(k); | ||
@@ -122,4 +120,3 @@ node = next; | ||
const n = prefix.length; | ||
if (n < 1) | ||
return false; | ||
if (n < 1) return false; | ||
const path = []; | ||
@@ -134,4 +131,3 @@ const key = []; | ||
node = node.next[k]; | ||
if (!node) | ||
return false; | ||
if (!node) return false; | ||
} | ||
@@ -142,4 +138,3 @@ if (val !== void 0) { | ||
vals2.delete(val); | ||
if (vals2.size > 0) | ||
return true; | ||
if (vals2.size > 0) return true; | ||
} else { | ||
@@ -151,4 +146,3 @@ return false; | ||
delete node.next[key[i]]; | ||
if (--node.n) | ||
break; | ||
if (--node.n) break; | ||
} | ||
@@ -155,0 +149,0 @@ return true; |
{ | ||
"name": "@thi.ng/associative", | ||
"version": "6.3.59", | ||
"version": "6.3.60", | ||
"description": "Alternative Map and Set implementations with customizable equality semantics & supporting operations, plain object utilities", | ||
@@ -39,19 +39,19 @@ "type": "module", | ||
"dependencies": { | ||
"@thi.ng/api": "^8.11.1", | ||
"@thi.ng/arrays": "^2.9.5", | ||
"@thi.ng/binary": "^3.4.24", | ||
"@thi.ng/checks": "^3.6.3", | ||
"@thi.ng/compare": "^2.3.4", | ||
"@thi.ng/dcons": "^3.2.112", | ||
"@thi.ng/equiv": "^2.1.57", | ||
"@thi.ng/errors": "^2.5.6", | ||
"@thi.ng/random": "^3.7.5", | ||
"@thi.ng/transducers": "^9.0.4", | ||
"@thi.ng/api": "^8.11.2", | ||
"@thi.ng/arrays": "^2.9.6", | ||
"@thi.ng/binary": "^3.4.25", | ||
"@thi.ng/checks": "^3.6.4", | ||
"@thi.ng/compare": "^2.3.5", | ||
"@thi.ng/dcons": "^3.2.113", | ||
"@thi.ng/equiv": "^2.1.58", | ||
"@thi.ng/errors": "^2.5.7", | ||
"@thi.ng/random": "^3.8.0", | ||
"@thi.ng/transducers": "^9.0.5", | ||
"tslib": "^2.6.2" | ||
}, | ||
"devDependencies": { | ||
"@microsoft/api-extractor": "^7.43.0", | ||
"esbuild": "^0.20.2", | ||
"typedoc": "^0.25.12", | ||
"typescript": "^5.4.3" | ||
"@microsoft/api-extractor": "^7.43.2", | ||
"esbuild": "^0.21.1", | ||
"typedoc": "^0.25.13", | ||
"typescript": "^5.4.5" | ||
}, | ||
@@ -201,3 +201,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "aed3421c21044c005fbcb7cc37965ccf85a870d2\n" | ||
"gitHead": "df34b4a9e650cc7323575356de207d78933bdcf3\n" | ||
} |
@@ -17,4 +17,3 @@ import { isArray } from "@thi.ng/checks/is-array"; | ||
const renameTransformedKeys = (src, keys) => { | ||
if (!src) | ||
return {}; | ||
if (!src) return {}; | ||
const res = {}; | ||
@@ -25,4 +24,3 @@ for (let $k in keys) { | ||
const val = src[$k]; | ||
if (val != null) | ||
res[k] = fn ? fn(val, src) : val; | ||
if (val != null) res[k] = fn ? fn(val, src) : val; | ||
} | ||
@@ -29,0 +27,0 @@ return res; |
@@ -13,4 +13,3 @@ import { empty } from "./empty.js"; | ||
const val = src.get(k); | ||
if (val != null) | ||
dest.set(k, val); | ||
if (val != null) dest.set(k, val); | ||
} | ||
@@ -30,4 +29,3 @@ return dest; | ||
const val = src[k]; | ||
if (val != null) | ||
res[k] = val; | ||
if (val != null) res[k] = val; | ||
} | ||
@@ -34,0 +32,0 @@ return res; |
@@ -8,4 +8,3 @@ var __defProp = Object.defineProperty; | ||
result = (kind ? decorator(target, key, result) : decorator(result)) || result; | ||
if (kind && result) | ||
__defProp(target, key, result); | ||
if (kind && result) __defProp(target, key, result); | ||
return result; | ||
@@ -82,4 +81,3 @@ }; | ||
const { cmp, size } = __private.get(this); | ||
if (!size) | ||
return; | ||
if (!size) return; | ||
if (max) { | ||
@@ -93,4 +91,3 @@ let node = this.firstNode(); | ||
let node = this.firstNode(); | ||
while (node.down) | ||
node = node.down; | ||
while (node.down) node = node.down; | ||
while (node) { | ||
@@ -136,6 +133,4 @@ if (node.k !== void 0 && cmp(node.k, key) >= 0) { | ||
const m = o.size; | ||
if (n < m) | ||
return -1; | ||
if (n > m) | ||
return 1; | ||
if (n < m) return -1; | ||
if (n > m) return 1; | ||
const i = this.entries(); | ||
@@ -196,4 +191,3 @@ const j = o.entries(); | ||
} | ||
while (!node.up) | ||
node = node.prev; | ||
while (!node.up) node = node.prev; | ||
node = node.up; | ||
@@ -212,6 +206,4 @@ const tmp = new Node(key, val, node.level); | ||
let node = this.findNode(key); | ||
if (node.k === void 0 || $this.cmp(node.k, key) !== 0) | ||
return false; | ||
while (node.down) | ||
node = node.down; | ||
if (node.k === void 0 || $this.cmp(node.k, key) !== 0) return false; | ||
while (node.down) node = node.down; | ||
let prev; | ||
@@ -222,6 +214,4 @@ let next; | ||
next = node.next; | ||
if (prev) | ||
prev.next = next; | ||
if (next) | ||
next.prev = prev; | ||
if (prev) prev.next = next; | ||
if (next) next.prev = prev; | ||
node = node.up; | ||
@@ -280,4 +270,3 @@ } | ||
b.next = a.next; | ||
if (a.next) | ||
a.next.prev = b; | ||
if (a.next) a.next.prev = b; | ||
a.next = b; | ||
@@ -302,8 +291,5 @@ } | ||
let node = head; | ||
while (node.down) | ||
node = node.down; | ||
while (node.prev) | ||
node = node.prev; | ||
if (node.next) | ||
node = node.next; | ||
while (node.down) node = node.down; | ||
while (node.prev) node = node.prev; | ||
if (node.next) node = node.next; | ||
return node; | ||
@@ -330,7 +316,5 @@ } | ||
nodeKey = node.k; | ||
if (nodeKey !== void 0 && cmp(nodeKey, key) === 0) | ||
break; | ||
if (nodeKey !== void 0 && cmp(nodeKey, key) === 0) break; | ||
down = node.down; | ||
if (!down) | ||
break; | ||
if (!down) break; | ||
node = down; | ||
@@ -337,0 +321,0 @@ } |
@@ -8,4 +8,3 @@ var __defProp = Object.defineProperty; | ||
result = (kind ? decorator(target, key, result) : decorator(result)) || result; | ||
if (kind && result) | ||
__defProp(target, key, result); | ||
if (kind && result) __defProp(target, key, result); | ||
return result; | ||
@@ -61,6 +60,4 @@ }; | ||
const m = o.size; | ||
if (n < m) | ||
return -1; | ||
if (n > m) | ||
return 1; | ||
if (n < m) return -1; | ||
if (n > m) return 1; | ||
const i = this.entries(); | ||
@@ -67,0 +64,0 @@ const j = o.entries(); |
@@ -8,4 +8,3 @@ var __defProp = Object.defineProperty; | ||
result = (kind ? decorator(target, key, result) : decorator(result)) || result; | ||
if (kind && result) | ||
__defProp(target, key, result); | ||
if (kind && result) __defProp(target, key, result); | ||
return result; | ||
@@ -12,0 +11,0 @@ }; |
@@ -67,4 +67,3 @@ import { vals } from "@thi.ng/transducers/vals"; | ||
node = node.next[key[i]]; | ||
if (!node) | ||
return; | ||
if (!node) return; | ||
} | ||
@@ -85,4 +84,3 @@ return node; | ||
const next = node.next[k]; | ||
if (!next) | ||
break; | ||
if (!next) break; | ||
prefix += k; | ||
@@ -112,4 +110,3 @@ node = next; | ||
const n = prefix.length; | ||
if (n < 1) | ||
return false; | ||
if (n < 1) return false; | ||
const path = []; | ||
@@ -124,9 +121,7 @@ const key = []; | ||
node = node.next[k]; | ||
if (!node) | ||
return false; | ||
if (!node) return false; | ||
} | ||
while (node = path[--i]) { | ||
delete node.next[key[i]]; | ||
if (--node.n) | ||
break; | ||
if (--node.n) break; | ||
} | ||
@@ -133,0 +128,0 @@ return true; |
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
160597
3703
Updated@thi.ng/api@^8.11.2
Updated@thi.ng/arrays@^2.9.6
Updated@thi.ng/binary@^3.4.25
Updated@thi.ng/checks@^3.6.4
Updated@thi.ng/compare@^2.3.5
Updated@thi.ng/dcons@^3.2.113
Updated@thi.ng/equiv@^2.1.58
Updated@thi.ng/errors@^2.5.7
Updated@thi.ng/random@^3.8.0
Updated@thi.ng/transducers@^9.0.5