@thi.ng/oquery 2.2.39 → 2.2.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -1
- package/match.js +3 -6
- package/package.json +12 -13
- package/query.js +5 -10
package/CHANGELOG.md
CHANGED
package/match.js
CHANGED
|
@@ -19,15 +19,13 @@ const matchMultiple = (key, includes, excludes, opts = {}) => {
|
|
|
19
19
|
(values) => {
|
|
20
20
|
const $values = valueFn ? valueFn(values) : values;
|
|
21
21
|
for (let x of excludes) {
|
|
22
|
-
if ($values.includes(x))
|
|
23
|
-
return false;
|
|
22
|
+
if ($values.includes(x)) return false;
|
|
24
23
|
}
|
|
25
24
|
let match = false;
|
|
26
25
|
for (let x of includes) {
|
|
27
26
|
if ($values.includes(x)) {
|
|
28
27
|
match = true;
|
|
29
|
-
if (union)
|
|
30
|
-
break;
|
|
28
|
+
if (union) break;
|
|
31
29
|
} else if (!union) {
|
|
32
30
|
match = false;
|
|
33
31
|
break;
|
|
@@ -44,8 +42,7 @@ const matchPattern = (key, expr, opts) => {
|
|
|
44
42
|
if (expr instanceof RegExp) {
|
|
45
43
|
re = expr;
|
|
46
44
|
} else {
|
|
47
|
-
if (expr === "*")
|
|
48
|
-
return { q: [key, (x) => x != null], opts };
|
|
45
|
+
if (expr === "*") return { q: [key, (x) => x != null], opts };
|
|
49
46
|
if (/^[<>=!]/.test(expr)) {
|
|
50
47
|
const op = /^[<>=!]+/.exec(expr)[0];
|
|
51
48
|
const arg = expr.substring(op.length).trim();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/oquery",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.41",
|
|
4
4
|
"description": "Datalog-inspired, optimized pattern/predicate query engine for JS objects & arrays of objects",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"build": "yarn build:esbuild && yarn build:decl",
|
|
28
28
|
"build:decl": "tsc --declaration --emitDeclarationOnly",
|
|
29
29
|
"build:esbuild": "esbuild --format=esm --platform=neutral --target=es2022 --tsconfig=tsconfig.json --outdir=. src/**/*.ts",
|
|
30
|
-
"clean": "
|
|
30
|
+
"clean": "bun ../../tools/src/clean-package.ts",
|
|
31
31
|
"doc": "typedoc --excludePrivate --excludeInternal --out doc src/index.ts",
|
|
32
32
|
"doc:ae": "mkdir -p .ae/doc .ae/temp && api-extractor run --local --verbose",
|
|
33
33
|
"doc:readme": "bun ../../tools/src/module-stats.ts && bun ../../tools/src/readme.ts",
|
|
@@ -36,18 +36,17 @@
|
|
|
36
36
|
"tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@thi.ng/api": "^8.11.
|
|
40
|
-
"@thi.ng/checks": "^3.6.
|
|
41
|
-
"@thi.ng/compare": "^2.3.
|
|
42
|
-
"@thi.ng/defmulti": "^3.0.
|
|
43
|
-
"@thi.ng/equiv": "^2.1.
|
|
39
|
+
"@thi.ng/api": "^8.11.2",
|
|
40
|
+
"@thi.ng/checks": "^3.6.4",
|
|
41
|
+
"@thi.ng/compare": "^2.3.5",
|
|
42
|
+
"@thi.ng/defmulti": "^3.0.39",
|
|
43
|
+
"@thi.ng/equiv": "^2.1.58"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@microsoft/api-extractor": "^7.43.
|
|
47
|
-
"esbuild": "^0.
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"typescript": "^5.4.3"
|
|
46
|
+
"@microsoft/api-extractor": "^7.43.2",
|
|
47
|
+
"esbuild": "^0.21.1",
|
|
48
|
+
"typedoc": "^0.25.13",
|
|
49
|
+
"typescript": "^5.4.5"
|
|
51
50
|
},
|
|
52
51
|
"keywords": [
|
|
53
52
|
"array",
|
|
@@ -97,5 +96,5 @@
|
|
|
97
96
|
],
|
|
98
97
|
"year": 2020
|
|
99
98
|
},
|
|
100
|
-
"gitHead": "
|
|
99
|
+
"gitHead": "df34b4a9e650cc7323575356de207d78933bdcf3\n"
|
|
101
100
|
}
|
package/query.js
CHANGED
|
@@ -15,8 +15,7 @@ const intersect = (src) => {
|
|
|
15
15
|
return (b) => {
|
|
16
16
|
const $b = ensureSet(b);
|
|
17
17
|
for (let i = num; i-- > 0; ) {
|
|
18
|
-
if (!$b.has(a[i]))
|
|
19
|
-
return false;
|
|
18
|
+
if (!$b.has(a[i])) return false;
|
|
20
19
|
}
|
|
21
20
|
return true;
|
|
22
21
|
};
|
|
@@ -299,26 +298,22 @@ const defKeyQuery = (opts) => {
|
|
|
299
298
|
} else {
|
|
300
299
|
const res = objQuery(src, $opts, args.slice(0, 3));
|
|
301
300
|
const out = args[3];
|
|
302
|
-
if (!out)
|
|
303
|
-
|
|
304
|
-
for (let k in res)
|
|
305
|
-
out.add(k);
|
|
301
|
+
if (!out) return new Set(Object.keys(res));
|
|
302
|
+
for (let k in res) out.add(k);
|
|
306
303
|
return out;
|
|
307
304
|
}
|
|
308
305
|
};
|
|
309
306
|
};
|
|
310
307
|
const query = (db, terms, opts = {}) => {
|
|
311
308
|
for (let term of terms) {
|
|
312
|
-
if (!term)
|
|
313
|
-
continue;
|
|
309
|
+
if (!term) continue;
|
|
314
310
|
db = defQuery(term.opts)(
|
|
315
311
|
db,
|
|
316
312
|
term.q[0],
|
|
317
313
|
term.q[1]
|
|
318
314
|
);
|
|
319
315
|
term.post && (db = term.post(db));
|
|
320
|
-
if (!db.length)
|
|
321
|
-
return db;
|
|
316
|
+
if (!db.length) return db;
|
|
322
317
|
}
|
|
323
318
|
const limit = opts.limit || 0;
|
|
324
319
|
if (limit > 0 && limit < db.length) {
|