typeson-registry 14.2.2 → 14.3.0

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.
@@ -3259,6 +3259,27 @@
3259
3259
  }
3260
3260
  });
3261
3261
 
3262
+ /**
3263
+ * @type {import('typeson').Preset}
3264
+ */
3265
+ var structuredCloningForStorage = structuredCloningThrowing.concat({
3266
+ checkSharedArrayBufferException: {
3267
+ test: function test(val) {
3268
+ // Per https://webidl.spec.whatwg.org/#idl-SharedArrayBuffer ,
3269
+ // `SharedArrayBuffer` is a structured-cloneable *transferable*
3270
+ // type only for `postMessage`-style contexts (with
3271
+ // `crossOriginIsolated`); storage-oriented consumers of the
3272
+ // structured clone algorithm (e.g. IndexedDB) reject it
3273
+ // outright instead, so this isn't part of the more general
3274
+ // `structuredCloningThrowing` preset this one builds on.
3275
+ if ({}.toString.call(val).slice(8, -1) === 'SharedArrayBuffer') {
3276
+ throw new DOMException('The object cannot be cloned.', 'DataCloneError');
3277
+ }
3278
+ return false;
3279
+ }
3280
+ }
3281
+ });
3282
+
3262
3283
  /**
3263
3284
  * @type {import('typeson').Preset}
3264
3285
  */
@@ -3327,6 +3348,7 @@
3327
3348
  exports.sparseUndefined = sparseUndefined;
3328
3349
  exports.specialNumbers = specialNumbers;
3329
3350
  exports.structuredCloning = expObj;
3351
+ exports.structuredCloningForStorage = structuredCloningForStorage;
3330
3352
  exports.structuredCloningThrowing = structuredCloningThrowing;
3331
3353
  exports.symbol = symbol;
3332
3354
  exports.toStringTag = toStringTag;