@thi.ng/oquery 2.3.47 → 2.3.49
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/README.md +1 -1
- package/match.js +2 -2
- package/package.json +7 -7
- package/query.js +13 -13
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
[](https://mastodon.thi.ng/@toxi)
|
|
8
8
|
|
|
9
9
|
> [!NOTE]
|
|
10
|
-
> This is one of
|
|
10
|
+
> This is one of 212 standalone projects, maintained as part
|
|
11
11
|
> of the [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo
|
|
12
12
|
> and anti-framework.
|
|
13
13
|
>
|
package/match.js
CHANGED
|
@@ -18,11 +18,11 @@ const matchMultiple = (key, includes, excludes, opts = {}) => {
|
|
|
18
18
|
key,
|
|
19
19
|
(values) => {
|
|
20
20
|
const $values = valueFn ? valueFn(values) : values;
|
|
21
|
-
for (
|
|
21
|
+
for (const x of excludes) {
|
|
22
22
|
if ($values.includes(x)) return false;
|
|
23
23
|
}
|
|
24
24
|
let match = false;
|
|
25
|
-
for (
|
|
25
|
+
for (const x of includes) {
|
|
26
26
|
if ($values.includes(x)) {
|
|
27
27
|
match = true;
|
|
28
28
|
if (union) break;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/oquery",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.49",
|
|
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",
|
|
@@ -39,11 +39,11 @@
|
|
|
39
39
|
"tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@thi.ng/api": "^8.12.
|
|
43
|
-
"@thi.ng/checks": "^3.
|
|
44
|
-
"@thi.ng/compare": "^2.4.
|
|
45
|
-
"@thi.ng/defmulti": "^3.0.
|
|
46
|
-
"@thi.ng/equiv": "^2.1.
|
|
42
|
+
"@thi.ng/api": "^8.12.11",
|
|
43
|
+
"@thi.ng/checks": "^3.8.1",
|
|
44
|
+
"@thi.ng/compare": "^2.4.37",
|
|
45
|
+
"@thi.ng/defmulti": "^3.0.87",
|
|
46
|
+
"@thi.ng/equiv": "^2.1.101"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"esbuild": "^0.27.0",
|
|
@@ -99,5 +99,5 @@
|
|
|
99
99
|
],
|
|
100
100
|
"year": 2020
|
|
101
101
|
},
|
|
102
|
-
"gitHead": "
|
|
102
|
+
"gitHead": "e7a21b9d2a188fa04d4c893d8531c40fbc0f4c06\n"
|
|
103
103
|
}
|
package/query.js
CHANGED
|
@@ -61,11 +61,11 @@ const __collectSP = (res, sval, s, p, o, opts) => {
|
|
|
61
61
|
};
|
|
62
62
|
const __collectSO = (res, sval, s, o, opts) => {
|
|
63
63
|
if (opts.partial) {
|
|
64
|
-
for (
|
|
64
|
+
for (const p in sval) {
|
|
65
65
|
__collect(res, s, p, o, sval[p], opts);
|
|
66
66
|
}
|
|
67
67
|
} else {
|
|
68
|
-
for (
|
|
68
|
+
for (const p in sval) {
|
|
69
69
|
if (__match(o, sval[p], opts)) {
|
|
70
70
|
__collectFull(res, s, sval);
|
|
71
71
|
return;
|
|
@@ -137,34 +137,34 @@ const __queryFN = (res, db, s, _, o, opts) => {
|
|
|
137
137
|
};
|
|
138
138
|
const __queryNL = (res, db, _, p, o, opts) => {
|
|
139
139
|
if (opts.partial) {
|
|
140
|
-
for (
|
|
140
|
+
for (const s in db) {
|
|
141
141
|
__collect(res, s, p, o, db[s][p], opts);
|
|
142
142
|
}
|
|
143
143
|
} else {
|
|
144
|
-
for (
|
|
144
|
+
for (const s in db) {
|
|
145
145
|
const sval = db[s];
|
|
146
146
|
__match(o, sval[p], opts) && __collectFull(res, s, sval);
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
149
|
};
|
|
150
150
|
const __queryNF = (res, db, _, p, o, opts) => {
|
|
151
|
-
for (
|
|
151
|
+
for (const s in db) {
|
|
152
152
|
__collectSP(res, db[s], s, p, o, opts);
|
|
153
153
|
}
|
|
154
154
|
};
|
|
155
155
|
const __queryNN = (res, db, _, __, o, opts) => {
|
|
156
|
-
for (
|
|
156
|
+
for (const s in db) {
|
|
157
157
|
__collectSO(res, db[s], s, o, opts);
|
|
158
158
|
}
|
|
159
159
|
};
|
|
160
160
|
const __queryNLNPartial = (res, db, _, p) => {
|
|
161
|
-
for (
|
|
161
|
+
for (const s in db) {
|
|
162
162
|
const val = db[s][p];
|
|
163
163
|
val != null && __addTriple(res, s, p, val);
|
|
164
164
|
}
|
|
165
165
|
};
|
|
166
166
|
const __queryNLN = (res, db, _, p) => {
|
|
167
|
-
for (
|
|
167
|
+
for (const s in db) {
|
|
168
168
|
const sval = db[s];
|
|
169
169
|
const val = sval[p];
|
|
170
170
|
val != null && __collectFull(res, s, sval);
|
|
@@ -172,14 +172,14 @@ const __queryNLN = (res, db, _, p) => {
|
|
|
172
172
|
};
|
|
173
173
|
const __querySP = (res, sval, s, p, _, opts) => {
|
|
174
174
|
if (opts.partial) {
|
|
175
|
-
for (
|
|
175
|
+
for (const q in sval) {
|
|
176
176
|
if (p(q)) {
|
|
177
177
|
const val = sval[q];
|
|
178
178
|
val != null && __addTriple(res, s, q, val);
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
181
|
} else {
|
|
182
|
-
for (
|
|
182
|
+
for (const q in sval) {
|
|
183
183
|
if (p(q)) {
|
|
184
184
|
__collectFull(res, s, sval);
|
|
185
185
|
return;
|
|
@@ -234,7 +234,7 @@ const IMPLS = {
|
|
|
234
234
|
nfl: __queryNF,
|
|
235
235
|
nff: __queryNF,
|
|
236
236
|
nfn: (res, db, _, p, __, opts) => {
|
|
237
|
-
for (
|
|
237
|
+
for (const s in db) {
|
|
238
238
|
__querySP(res, db[s], s, p, null, opts);
|
|
239
239
|
}
|
|
240
240
|
},
|
|
@@ -299,13 +299,13 @@ const defKeyQuery = (opts) => {
|
|
|
299
299
|
const res = __objQuery(src, $opts, args.slice(0, 3));
|
|
300
300
|
const out = args[3];
|
|
301
301
|
if (!out) return new Set(Object.keys(res));
|
|
302
|
-
for (
|
|
302
|
+
for (const k in res) out.add(k);
|
|
303
303
|
return out;
|
|
304
304
|
}
|
|
305
305
|
});
|
|
306
306
|
};
|
|
307
307
|
const query = (db, terms, opts = {}) => {
|
|
308
|
-
for (
|
|
308
|
+
for (const term of terms) {
|
|
309
309
|
if (!term) continue;
|
|
310
310
|
db = defQuery(term.opts)(
|
|
311
311
|
db,
|