@thi.ng/oquery 2.2.40 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2024-04-23T07:02:18Z
3
+ - **Last updated**: 2024-05-08T18:24:32Z
4
4
  - **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
5
5
 
6
6
  All notable changes to this project will be documented in this file.
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.40",
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",
@@ -36,17 +36,17 @@
36
36
  "tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
37
37
  },
38
38
  "dependencies": {
39
- "@thi.ng/api": "^8.11.1",
40
- "@thi.ng/checks": "^3.6.3",
41
- "@thi.ng/compare": "^2.3.4",
42
- "@thi.ng/defmulti": "^3.0.38",
43
- "@thi.ng/equiv": "^2.1.57"
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.0",
47
- "esbuild": "^0.20.2",
48
- "typedoc": "^0.25.12",
49
- "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"
50
50
  },
51
51
  "keywords": [
52
52
  "array",
@@ -96,5 +96,5 @@
96
96
  ],
97
97
  "year": 2020
98
98
  },
99
- "gitHead": "5dd66c18a3862a3af69a5b2f49563f7cbdd960c2\n"
99
+ "gitHead": "df34b4a9e650cc7323575356de207d78933bdcf3\n"
100
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
- return new Set(Object.keys(res));
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) {