serializable-bptree 6.2.0 → 6.2.1

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 CHANGED
@@ -64,6 +64,7 @@ tree.where({ gt: 1 }) // Map([{ key: 'c', value: 3 }])
64
64
  tree.where({ lt: 2 }) // Map([{ key: 'a', value: 1 }])
65
65
  tree.where({ gt: 0, lt: 4 }) // Map([{ key: 'a', value: 1 }, { key: 'c', value: 3 }])
66
66
  tree.where({ or: [3, 1] }) // Map([{ key: 'a', value: 1 }, { key: 'c', value: 3 }])
67
+ tree.where({ like: 'user_%' }) // Matches values matching the pattern
67
68
 
68
69
  tree.clear()
69
70
  ```
@@ -494,7 +494,7 @@ var BPTree = class _BPTree {
494
494
  primaryOr: (nv, v) => this.ensureValues(v).some((v2) => this.comparator.isPrimarySame(nv, v2)),
495
495
  like: (nv, v) => {
496
496
  const nodeValue = this.comparator.match(nv);
497
- const value = this.comparator.match(v);
497
+ const value = v;
498
498
  const cache = this._cachedRegexp.cache(value);
499
499
  const regexp = cache.raw;
500
500
  return regexp.test(nodeValue);
@@ -460,7 +460,7 @@ var BPTree = class _BPTree {
460
460
  primaryOr: (nv, v) => this.ensureValues(v).some((v2) => this.comparator.isPrimarySame(nv, v2)),
461
461
  like: (nv, v) => {
462
462
  const nodeValue = this.comparator.match(nv);
463
- const value = this.comparator.match(v);
463
+ const value = v;
464
464
  const cache = this._cachedRegexp.cache(value);
465
465
  const regexp = cache.raw;
466
466
  return regexp.test(nodeValue);
@@ -21,7 +21,6 @@ export type BPTreeCondition<V> = Partial<{
21
21
  /** Searches for pairs that satisfy at least one of the conditions. */
22
22
  or: Partial<V>[];
23
23
  /** Searches for values matching the given pattern. '%' matches zero or more characters, and '_' matches exactly one character. */
24
- like: Partial<V>;
25
24
  /**
26
25
  * Searches for pairs where the primary field equals the given value.
27
26
  * Uses `primaryAsc` method for comparison, which compares only the primary sorting field.
@@ -40,6 +39,12 @@ export type BPTreeCondition<V> = Partial<{
40
39
  primaryNotEqual: Partial<V>;
41
40
  /** Searches for pairs where the primary field matches at least one of the given values. */
42
41
  primaryOr: Partial<V>[];
42
+ /**
43
+ * Searches for values matching the given pattern on the primary field.
44
+ * Uses `match` method for getting string representation.
45
+ * '%' matches zero or more characters, and '_' matches exactly one character.
46
+ */
47
+ like: string;
43
48
  }>;
44
49
  export type BPTreePair<K, V> = Map<K, V>;
45
50
  export type BPTreeUnknownNode<K, V> = BPTreeInternalNode<K, V> | BPTreeLeafNode<K, V>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "serializable-bptree",
3
- "version": "6.2.0",
3
+ "version": "6.2.1",
4
4
  "description": "Store the B+tree flexibly, not only in-memory.",
5
5
  "types": "./dist/types/index.d.ts",
6
6
  "main": "./dist/cjs/index.cjs",