@endo/promise-kit 1.1.12 → 1.1.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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@endo/promise-kit",
3
- "version": "1.1.12",
3
+ "version": "1.1.13",
4
4
  "description": "Helper for making promises",
5
5
  "keywords": [
6
6
  "promise"
@@ -37,7 +37,7 @@
37
37
  "test:xs": "exit 0"
38
38
  },
39
39
  "dependencies": {
40
- "ses": "^1.13.1"
40
+ "ses": "^1.14.0"
41
41
  },
42
42
  "devDependencies": {
43
43
  "ava": "^6.1.3",
@@ -82,5 +82,5 @@
82
82
  "typeCoverage": {
83
83
  "atLeast": 90.9
84
84
  },
85
- "gitHead": "03b92fc383da5d8bb4ea993b90149a0db5799d0b"
85
+ "gitHead": "9815aea9541f241389d2135c6097a7442bdffa17"
86
86
  }
@@ -1 +1 @@
1
- {"version":3,"file":"memo-race.d.ts","sourceRoot":"","sources":["memo-race.js"],"names":[],"mappings":";qBAiCc,CAAC;aAED,CAAC,KAAK,CAAC,EAAE,OAAO,YAAY,EAAE,IAAI,CAAC,CAAC,CAAC,KAAM,IAAI;YAC/C,CAAC,GAAG,CAAC,EAAE,GAAG,KAAM,IAAI;;gCAIpB,KAAK,GACb;IAAC,OAAO,EAAE,KAAK,CAAC;IAAC,SAAS,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAA;CAAC,GAC1C;IAAC,OAAO,EAAE,IAAI,CAAC;IAAC,SAAS,CAAC,EAAE,SAAS,CAAA;CAAC;AAgE1C;;;;;;;;;;;;GAYG;AACH,sBANuC,CAAC,SAA1B,SAAS,OAAO,EAAE,GAAG,EAAG,EACH,CAAC,SAAtB,kBAAmB,wCAEtB,CAAC,GACC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAiCvC"}
1
+ {"version":3,"file":"memo-race.d.ts","sourceRoot":"","sources":["memo-race.js"],"names":[],"mappings":";qBA+Cc,CAAC;aAED,CAAC,KAAK,CAAC,EAAE,OAAO,YAAY,EAAE,IAAI,CAAC,CAAC,CAAC,KAAM,IAAI;YAC/C,CAAC,GAAG,CAAC,EAAE,GAAG,KAAM,IAAI;;gCAIpB,KAAK,GACb;IAAC,OAAO,EAAE,KAAK,CAAC;IAAC,SAAS,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAA;CAAC,GAC1C;IAAC,OAAO,EAAE,IAAI,CAAC;IAAC,SAAS,CAAC,EAAE,SAAS,CAAA;CAAC;AAgE1C;;;;;;;;;;;;GAYG;AACH,sBANuC,CAAC,SAA1B,SAAS,OAAO,EAAE,GAAG,EAAG,EACH,CAAC,SAAtB,kBAAmB,wCAEtB,CAAC,GACC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAiCvC"}
package/src/memo-race.js CHANGED
@@ -28,7 +28,21 @@ OTHER DEALINGS IN THE SOFTWARE.
28
28
  For more information, please refer to <http://unlicense.org/>
29
29
  */
30
30
 
31
- const isObject = value => Object(value) === value;
31
+ /**
32
+ * TODO Consolidate with `isPrimitive` that's currently in `@endo/pass-style`.
33
+ * Layering constraints make this tricky, which is why we haven't yet figured
34
+ * out how to do this.
35
+ *
36
+ * @type {(val: unknown) => val is (undefined
37
+ * | null
38
+ * | boolean
39
+ * | number
40
+ * | bigint
41
+ * | string
42
+ * | symbol)}
43
+ */
44
+ const isPrimitive = val =>
45
+ !val || (typeof val !== 'object' && typeof val !== 'function');
32
46
 
33
47
  /**
34
48
  * @template [T=any]
@@ -73,7 +87,7 @@ const markSettled = record => {
73
87
  * @returns {PromiseMemoRecord}
74
88
  */
75
89
  const getMemoRecord = value => {
76
- if (!isObject(value)) {
90
+ if (isPrimitive(value)) {
77
91
  // If the contender is a primitive, attempting to use it as a key in the
78
92
  // weakmap would throw an error. Luckily, it is safe to call
79
93
  // `Promise.resolve(contender).then` on a primitive value multiple times