shelving 1.150.11 → 1.150.13

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/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "state-management",
12
12
  "query-builder"
13
13
  ],
14
- "version": "1.150.11",
14
+ "version": "1.150.13",
15
15
  "repository": "https://github.com/dhoulb/shelving",
16
16
  "author": "Dave Houlbrooke <dave@shax.com>",
17
17
  "license": "0BSD",
package/store/Store.d.ts CHANGED
@@ -40,4 +40,6 @@ export declare class Store<T> implements AsyncIterable<T> {
40
40
  through(sequence: AsyncIterable<T>): AsyncIterable<T>;
41
41
  [Symbol.asyncIterator](): AsyncGenerator<T, void, void>;
42
42
  private _iterating;
43
+ /** Compare two values for this store and return whether they are equal. */
44
+ equal(a: T, b: T): boolean;
43
45
  }
package/store/Store.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { DeferredSequence } from "../sequence/DeferredSequence.js";
2
2
  import { NONE } from "../util/constants.js";
3
+ import { isDeepEqual } from "../util/equal.js";
3
4
  import { getStarter } from "../util/start.js";
4
5
  /**
5
6
  * Store that retains its most recent value and is async-iterable to allow values to be observed.
@@ -25,7 +26,7 @@ export class Store {
25
26
  set value(value) {
26
27
  this._reason = undefined;
27
28
  this._time = Date.now();
28
- if (value !== this._value) {
29
+ if (this._value === NONE || !this.equal(value, this._value)) {
29
30
  this._value = value;
30
31
  this.next.resolve(value);
31
32
  }
@@ -95,4 +96,8 @@ export class Store {
95
96
  }
96
97
  }
97
98
  _iterating = 0;
99
+ /** Compare two values for this store and return whether they are equal. */
100
+ equal(a, b) {
101
+ return isDeepEqual(a, b);
102
+ }
98
103
  }