seroval 1.6.9 → 1.6.11
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/dist/dev/index.cjs +30 -23
- package/dist/dev/index.js +30 -23
- package/dist/index.cjs +30 -23
- package/dist/index.js +30 -23
- package/package.json +1 -1
package/dist/dev/index.cjs
CHANGED
|
@@ -395,6 +395,29 @@ function getObjectFlag(obj) {
|
|
|
395
395
|
return 1;
|
|
396
396
|
}
|
|
397
397
|
//#endregion
|
|
398
|
+
//#region src/core/utils/typed-array.ts
|
|
399
|
+
function getTypedArrayConstructor(name) {
|
|
400
|
+
switch (name) {
|
|
401
|
+
case "Int8Array": return Int8Array;
|
|
402
|
+
case "Int16Array": return Int16Array;
|
|
403
|
+
case "Int32Array": return Int32Array;
|
|
404
|
+
case "Uint8Array": return Uint8Array;
|
|
405
|
+
case "Uint16Array": return Uint16Array;
|
|
406
|
+
case "Uint32Array": return Uint32Array;
|
|
407
|
+
case "Uint8ClampedArray": return Uint8ClampedArray;
|
|
408
|
+
case "Float32Array": return Float32Array;
|
|
409
|
+
case "Float64Array": return Float64Array;
|
|
410
|
+
case "BigInt64Array": return BigInt64Array;
|
|
411
|
+
case "BigUint64Array": return BigUint64Array;
|
|
412
|
+
default: throw new SerovalUnknownTypedArrayError(name);
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
let typedArrayNameGetter;
|
|
416
|
+
function getTypedArrayName(value) {
|
|
417
|
+
if (!typedArrayNameGetter) typedArrayNameGetter = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Int8Array.prototype), Symbol.toStringTag).get;
|
|
418
|
+
return typedArrayNameGetter.call(value);
|
|
419
|
+
}
|
|
420
|
+
//#endregion
|
|
398
421
|
//#region src/core/base-primitives.ts
|
|
399
422
|
function createNumberNode(value) {
|
|
400
423
|
switch (value) {
|
|
@@ -442,11 +465,11 @@ function createBoxedNode(id, boxed) {
|
|
|
442
465
|
const MAX_TYPED_ARRAY_LENGTH = 1e6;
|
|
443
466
|
function createTypedArrayNode(id, current, buffer) {
|
|
444
467
|
if (current.length > MAX_TYPED_ARRAY_LENGTH) throw new SerovalUnsupportedTypeError(current);
|
|
445
|
-
return createSerovalNode(15, id, void 0, current
|
|
468
|
+
return createSerovalNode(15, id, void 0, getTypedArrayName(current), void 0, void 0, void 0, void 0, buffer, current.byteOffset, void 0, current.length);
|
|
446
469
|
}
|
|
447
470
|
function createBigIntTypedArrayNode(id, current, buffer) {
|
|
448
471
|
if (current.length > MAX_TYPED_ARRAY_LENGTH) throw new SerovalUnsupportedTypeError(current);
|
|
449
|
-
return createSerovalNode(16, id, void 0, current
|
|
472
|
+
return createSerovalNode(16, id, void 0, getTypedArrayName(current), void 0, void 0, void 0, void 0, buffer, current.byteOffset, void 0, current.length);
|
|
450
473
|
}
|
|
451
474
|
function createDataViewNode(id, current, buffer) {
|
|
452
475
|
if (current.byteLength > MAX_TYPED_ARRAY_LENGTH) throw new SerovalUnsupportedTypeError(current);
|
|
@@ -992,8 +1015,7 @@ function createPromiseConstructorNode(ctx, id, resolver) {
|
|
|
992
1015
|
function getArrayBufferView(ctx, current) {
|
|
993
1016
|
if (!ctx.compactArrayBufferViews) return current;
|
|
994
1017
|
const buffer = new Uint8Array(current.buffer, current.byteOffset, current.byteLength).slice().buffer;
|
|
995
|
-
|
|
996
|
-
return new Constructor(buffer);
|
|
1018
|
+
return new (current instanceof DataView ? DataView : getTypedArrayConstructor(getTypedArrayName(current)))(buffer);
|
|
997
1019
|
}
|
|
998
1020
|
function encodeArrayBuffer(current) {
|
|
999
1021
|
if (typeof Buffer !== "undefined") return Buffer.from(current).toString("base64");
|
|
@@ -1279,24 +1301,6 @@ function resolvePlugins(plugins) {
|
|
|
1279
1301
|
}
|
|
1280
1302
|
}
|
|
1281
1303
|
//#endregion
|
|
1282
|
-
//#region src/core/utils/typed-array.ts
|
|
1283
|
-
function getTypedArrayConstructor(name) {
|
|
1284
|
-
switch (name) {
|
|
1285
|
-
case "Int8Array": return Int8Array;
|
|
1286
|
-
case "Int16Array": return Int16Array;
|
|
1287
|
-
case "Int32Array": return Int32Array;
|
|
1288
|
-
case "Uint8Array": return Uint8Array;
|
|
1289
|
-
case "Uint16Array": return Uint16Array;
|
|
1290
|
-
case "Uint32Array": return Uint32Array;
|
|
1291
|
-
case "Uint8ClampedArray": return Uint8ClampedArray;
|
|
1292
|
-
case "Float32Array": return Float32Array;
|
|
1293
|
-
case "Float64Array": return Float64Array;
|
|
1294
|
-
case "BigInt64Array": return BigInt64Array;
|
|
1295
|
-
case "BigUint64Array": return BigUint64Array;
|
|
1296
|
-
default: throw new SerovalUnknownTypedArrayError(name);
|
|
1297
|
-
}
|
|
1298
|
-
}
|
|
1299
|
-
//#endregion
|
|
1300
1304
|
//#region src/core/utils/valid-properties.ts
|
|
1301
1305
|
function isValidKey(key) {
|
|
1302
1306
|
switch (key) {
|
|
@@ -2161,7 +2165,10 @@ function serializeTemporal(ctx, node) {
|
|
|
2161
2165
|
throw new SerovalUnsupportedNodeError(node);
|
|
2162
2166
|
}
|
|
2163
2167
|
function serializeRegExp(ctx, node) {
|
|
2164
|
-
if (ctx.base.features & 32)
|
|
2168
|
+
if (ctx.base.features & 32) {
|
|
2169
|
+
if (node.c.includes("\\x3C")) return "new RegExp(\"" + node.c + "\",\"" + node.m + "\")";
|
|
2170
|
+
return "/" + deserializeString(node.c) + "/" + node.m;
|
|
2171
|
+
}
|
|
2165
2172
|
throw new SerovalUnsupportedNodeError(node);
|
|
2166
2173
|
}
|
|
2167
2174
|
function serializeSetItem(ctx, id, item) {
|
package/dist/dev/index.js
CHANGED
|
@@ -394,6 +394,29 @@ function getObjectFlag(obj) {
|
|
|
394
394
|
return 1;
|
|
395
395
|
}
|
|
396
396
|
//#endregion
|
|
397
|
+
//#region src/core/utils/typed-array.ts
|
|
398
|
+
function getTypedArrayConstructor(name) {
|
|
399
|
+
switch (name) {
|
|
400
|
+
case "Int8Array": return Int8Array;
|
|
401
|
+
case "Int16Array": return Int16Array;
|
|
402
|
+
case "Int32Array": return Int32Array;
|
|
403
|
+
case "Uint8Array": return Uint8Array;
|
|
404
|
+
case "Uint16Array": return Uint16Array;
|
|
405
|
+
case "Uint32Array": return Uint32Array;
|
|
406
|
+
case "Uint8ClampedArray": return Uint8ClampedArray;
|
|
407
|
+
case "Float32Array": return Float32Array;
|
|
408
|
+
case "Float64Array": return Float64Array;
|
|
409
|
+
case "BigInt64Array": return BigInt64Array;
|
|
410
|
+
case "BigUint64Array": return BigUint64Array;
|
|
411
|
+
default: throw new SerovalUnknownTypedArrayError(name);
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
let typedArrayNameGetter;
|
|
415
|
+
function getTypedArrayName(value) {
|
|
416
|
+
if (!typedArrayNameGetter) typedArrayNameGetter = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Int8Array.prototype), Symbol.toStringTag).get;
|
|
417
|
+
return typedArrayNameGetter.call(value);
|
|
418
|
+
}
|
|
419
|
+
//#endregion
|
|
397
420
|
//#region src/core/base-primitives.ts
|
|
398
421
|
function createNumberNode(value) {
|
|
399
422
|
switch (value) {
|
|
@@ -441,11 +464,11 @@ function createBoxedNode(id, boxed) {
|
|
|
441
464
|
const MAX_TYPED_ARRAY_LENGTH = 1e6;
|
|
442
465
|
function createTypedArrayNode(id, current, buffer) {
|
|
443
466
|
if (current.length > MAX_TYPED_ARRAY_LENGTH) throw new SerovalUnsupportedTypeError(current);
|
|
444
|
-
return createSerovalNode(15, id, void 0, current
|
|
467
|
+
return createSerovalNode(15, id, void 0, getTypedArrayName(current), void 0, void 0, void 0, void 0, buffer, current.byteOffset, void 0, current.length);
|
|
445
468
|
}
|
|
446
469
|
function createBigIntTypedArrayNode(id, current, buffer) {
|
|
447
470
|
if (current.length > MAX_TYPED_ARRAY_LENGTH) throw new SerovalUnsupportedTypeError(current);
|
|
448
|
-
return createSerovalNode(16, id, void 0, current
|
|
471
|
+
return createSerovalNode(16, id, void 0, getTypedArrayName(current), void 0, void 0, void 0, void 0, buffer, current.byteOffset, void 0, current.length);
|
|
449
472
|
}
|
|
450
473
|
function createDataViewNode(id, current, buffer) {
|
|
451
474
|
if (current.byteLength > MAX_TYPED_ARRAY_LENGTH) throw new SerovalUnsupportedTypeError(current);
|
|
@@ -991,8 +1014,7 @@ function createPromiseConstructorNode(ctx, id, resolver) {
|
|
|
991
1014
|
function getArrayBufferView(ctx, current) {
|
|
992
1015
|
if (!ctx.compactArrayBufferViews) return current;
|
|
993
1016
|
const buffer = new Uint8Array(current.buffer, current.byteOffset, current.byteLength).slice().buffer;
|
|
994
|
-
|
|
995
|
-
return new Constructor(buffer);
|
|
1017
|
+
return new (current instanceof DataView ? DataView : getTypedArrayConstructor(getTypedArrayName(current)))(buffer);
|
|
996
1018
|
}
|
|
997
1019
|
function encodeArrayBuffer(current) {
|
|
998
1020
|
if (typeof Buffer !== "undefined") return Buffer.from(current).toString("base64");
|
|
@@ -1278,24 +1300,6 @@ function resolvePlugins(plugins) {
|
|
|
1278
1300
|
}
|
|
1279
1301
|
}
|
|
1280
1302
|
//#endregion
|
|
1281
|
-
//#region src/core/utils/typed-array.ts
|
|
1282
|
-
function getTypedArrayConstructor(name) {
|
|
1283
|
-
switch (name) {
|
|
1284
|
-
case "Int8Array": return Int8Array;
|
|
1285
|
-
case "Int16Array": return Int16Array;
|
|
1286
|
-
case "Int32Array": return Int32Array;
|
|
1287
|
-
case "Uint8Array": return Uint8Array;
|
|
1288
|
-
case "Uint16Array": return Uint16Array;
|
|
1289
|
-
case "Uint32Array": return Uint32Array;
|
|
1290
|
-
case "Uint8ClampedArray": return Uint8ClampedArray;
|
|
1291
|
-
case "Float32Array": return Float32Array;
|
|
1292
|
-
case "Float64Array": return Float64Array;
|
|
1293
|
-
case "BigInt64Array": return BigInt64Array;
|
|
1294
|
-
case "BigUint64Array": return BigUint64Array;
|
|
1295
|
-
default: throw new SerovalUnknownTypedArrayError(name);
|
|
1296
|
-
}
|
|
1297
|
-
}
|
|
1298
|
-
//#endregion
|
|
1299
1303
|
//#region src/core/utils/valid-properties.ts
|
|
1300
1304
|
function isValidKey(key) {
|
|
1301
1305
|
switch (key) {
|
|
@@ -2160,7 +2164,10 @@ function serializeTemporal(ctx, node) {
|
|
|
2160
2164
|
throw new SerovalUnsupportedNodeError(node);
|
|
2161
2165
|
}
|
|
2162
2166
|
function serializeRegExp(ctx, node) {
|
|
2163
|
-
if (ctx.base.features & 32)
|
|
2167
|
+
if (ctx.base.features & 32) {
|
|
2168
|
+
if (node.c.includes("\\x3C")) return "new RegExp(\"" + node.c + "\",\"" + node.m + "\")";
|
|
2169
|
+
return "/" + deserializeString(node.c) + "/" + node.m;
|
|
2170
|
+
}
|
|
2164
2171
|
throw new SerovalUnsupportedNodeError(node);
|
|
2165
2172
|
}
|
|
2166
2173
|
function serializeSetItem(ctx, id, item) {
|
package/dist/index.cjs
CHANGED
|
@@ -388,6 +388,29 @@ function getObjectFlag(obj) {
|
|
|
388
388
|
return 1;
|
|
389
389
|
}
|
|
390
390
|
//#endregion
|
|
391
|
+
//#region src/core/utils/typed-array.ts
|
|
392
|
+
function getTypedArrayConstructor(name) {
|
|
393
|
+
switch (name) {
|
|
394
|
+
case "Int8Array": return Int8Array;
|
|
395
|
+
case "Int16Array": return Int16Array;
|
|
396
|
+
case "Int32Array": return Int32Array;
|
|
397
|
+
case "Uint8Array": return Uint8Array;
|
|
398
|
+
case "Uint16Array": return Uint16Array;
|
|
399
|
+
case "Uint32Array": return Uint32Array;
|
|
400
|
+
case "Uint8ClampedArray": return Uint8ClampedArray;
|
|
401
|
+
case "Float32Array": return Float32Array;
|
|
402
|
+
case "Float64Array": return Float64Array;
|
|
403
|
+
case "BigInt64Array": return BigInt64Array;
|
|
404
|
+
case "BigUint64Array": return BigUint64Array;
|
|
405
|
+
default: throw new SerovalUnknownTypedArrayError(name);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
let typedArrayNameGetter;
|
|
409
|
+
function getTypedArrayName(value) {
|
|
410
|
+
if (!typedArrayNameGetter) typedArrayNameGetter = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Int8Array.prototype), Symbol.toStringTag).get;
|
|
411
|
+
return typedArrayNameGetter.call(value);
|
|
412
|
+
}
|
|
413
|
+
//#endregion
|
|
391
414
|
//#region src/core/base-primitives.ts
|
|
392
415
|
function createNumberNode(value) {
|
|
393
416
|
switch (value) {
|
|
@@ -435,11 +458,11 @@ function createBoxedNode(id, boxed) {
|
|
|
435
458
|
const MAX_TYPED_ARRAY_LENGTH = 1e6;
|
|
436
459
|
function createTypedArrayNode(id, current, buffer) {
|
|
437
460
|
if (current.length > MAX_TYPED_ARRAY_LENGTH) throw new SerovalUnsupportedTypeError(current);
|
|
438
|
-
return createSerovalNode(15, id, void 0, current
|
|
461
|
+
return createSerovalNode(15, id, void 0, getTypedArrayName(current), void 0, void 0, void 0, void 0, buffer, current.byteOffset, void 0, current.length);
|
|
439
462
|
}
|
|
440
463
|
function createBigIntTypedArrayNode(id, current, buffer) {
|
|
441
464
|
if (current.length > MAX_TYPED_ARRAY_LENGTH) throw new SerovalUnsupportedTypeError(current);
|
|
442
|
-
return createSerovalNode(16, id, void 0, current
|
|
465
|
+
return createSerovalNode(16, id, void 0, getTypedArrayName(current), void 0, void 0, void 0, void 0, buffer, current.byteOffset, void 0, current.length);
|
|
443
466
|
}
|
|
444
467
|
function createDataViewNode(id, current, buffer) {
|
|
445
468
|
if (current.byteLength > MAX_TYPED_ARRAY_LENGTH) throw new SerovalUnsupportedTypeError(current);
|
|
@@ -985,8 +1008,7 @@ function createPromiseConstructorNode(ctx, id, resolver) {
|
|
|
985
1008
|
function getArrayBufferView(ctx, current) {
|
|
986
1009
|
if (!ctx.compactArrayBufferViews) return current;
|
|
987
1010
|
const buffer = new Uint8Array(current.buffer, current.byteOffset, current.byteLength).slice().buffer;
|
|
988
|
-
|
|
989
|
-
return new Constructor(buffer);
|
|
1011
|
+
return new (current instanceof DataView ? DataView : getTypedArrayConstructor(getTypedArrayName(current)))(buffer);
|
|
990
1012
|
}
|
|
991
1013
|
function encodeArrayBuffer(current) {
|
|
992
1014
|
if (typeof Buffer !== "undefined") return Buffer.from(current).toString("base64");
|
|
@@ -1272,24 +1294,6 @@ function resolvePlugins(plugins) {
|
|
|
1272
1294
|
}
|
|
1273
1295
|
}
|
|
1274
1296
|
//#endregion
|
|
1275
|
-
//#region src/core/utils/typed-array.ts
|
|
1276
|
-
function getTypedArrayConstructor(name) {
|
|
1277
|
-
switch (name) {
|
|
1278
|
-
case "Int8Array": return Int8Array;
|
|
1279
|
-
case "Int16Array": return Int16Array;
|
|
1280
|
-
case "Int32Array": return Int32Array;
|
|
1281
|
-
case "Uint8Array": return Uint8Array;
|
|
1282
|
-
case "Uint16Array": return Uint16Array;
|
|
1283
|
-
case "Uint32Array": return Uint32Array;
|
|
1284
|
-
case "Uint8ClampedArray": return Uint8ClampedArray;
|
|
1285
|
-
case "Float32Array": return Float32Array;
|
|
1286
|
-
case "Float64Array": return Float64Array;
|
|
1287
|
-
case "BigInt64Array": return BigInt64Array;
|
|
1288
|
-
case "BigUint64Array": return BigUint64Array;
|
|
1289
|
-
default: throw new SerovalUnknownTypedArrayError(name);
|
|
1290
|
-
}
|
|
1291
|
-
}
|
|
1292
|
-
//#endregion
|
|
1293
1297
|
//#region src/core/utils/valid-properties.ts
|
|
1294
1298
|
function isValidKey(key) {
|
|
1295
1299
|
switch (key) {
|
|
@@ -2154,7 +2158,10 @@ function serializeTemporal(ctx, node) {
|
|
|
2154
2158
|
throw new SerovalUnsupportedNodeError(node);
|
|
2155
2159
|
}
|
|
2156
2160
|
function serializeRegExp(ctx, node) {
|
|
2157
|
-
if (ctx.base.features & 32)
|
|
2161
|
+
if (ctx.base.features & 32) {
|
|
2162
|
+
if (node.c.includes("\\x3C")) return "new RegExp(\"" + node.c + "\",\"" + node.m + "\")";
|
|
2163
|
+
return "/" + deserializeString(node.c) + "/" + node.m;
|
|
2164
|
+
}
|
|
2158
2165
|
throw new SerovalUnsupportedNodeError(node);
|
|
2159
2166
|
}
|
|
2160
2167
|
function serializeSetItem(ctx, id, item) {
|
package/dist/index.js
CHANGED
|
@@ -387,6 +387,29 @@ function getObjectFlag(obj) {
|
|
|
387
387
|
return 1;
|
|
388
388
|
}
|
|
389
389
|
//#endregion
|
|
390
|
+
//#region src/core/utils/typed-array.ts
|
|
391
|
+
function getTypedArrayConstructor(name) {
|
|
392
|
+
switch (name) {
|
|
393
|
+
case "Int8Array": return Int8Array;
|
|
394
|
+
case "Int16Array": return Int16Array;
|
|
395
|
+
case "Int32Array": return Int32Array;
|
|
396
|
+
case "Uint8Array": return Uint8Array;
|
|
397
|
+
case "Uint16Array": return Uint16Array;
|
|
398
|
+
case "Uint32Array": return Uint32Array;
|
|
399
|
+
case "Uint8ClampedArray": return Uint8ClampedArray;
|
|
400
|
+
case "Float32Array": return Float32Array;
|
|
401
|
+
case "Float64Array": return Float64Array;
|
|
402
|
+
case "BigInt64Array": return BigInt64Array;
|
|
403
|
+
case "BigUint64Array": return BigUint64Array;
|
|
404
|
+
default: throw new SerovalUnknownTypedArrayError(name);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
let typedArrayNameGetter;
|
|
408
|
+
function getTypedArrayName(value) {
|
|
409
|
+
if (!typedArrayNameGetter) typedArrayNameGetter = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Int8Array.prototype), Symbol.toStringTag).get;
|
|
410
|
+
return typedArrayNameGetter.call(value);
|
|
411
|
+
}
|
|
412
|
+
//#endregion
|
|
390
413
|
//#region src/core/base-primitives.ts
|
|
391
414
|
function createNumberNode(value) {
|
|
392
415
|
switch (value) {
|
|
@@ -434,11 +457,11 @@ function createBoxedNode(id, boxed) {
|
|
|
434
457
|
const MAX_TYPED_ARRAY_LENGTH = 1e6;
|
|
435
458
|
function createTypedArrayNode(id, current, buffer) {
|
|
436
459
|
if (current.length > MAX_TYPED_ARRAY_LENGTH) throw new SerovalUnsupportedTypeError(current);
|
|
437
|
-
return createSerovalNode(15, id, void 0, current
|
|
460
|
+
return createSerovalNode(15, id, void 0, getTypedArrayName(current), void 0, void 0, void 0, void 0, buffer, current.byteOffset, void 0, current.length);
|
|
438
461
|
}
|
|
439
462
|
function createBigIntTypedArrayNode(id, current, buffer) {
|
|
440
463
|
if (current.length > MAX_TYPED_ARRAY_LENGTH) throw new SerovalUnsupportedTypeError(current);
|
|
441
|
-
return createSerovalNode(16, id, void 0, current
|
|
464
|
+
return createSerovalNode(16, id, void 0, getTypedArrayName(current), void 0, void 0, void 0, void 0, buffer, current.byteOffset, void 0, current.length);
|
|
442
465
|
}
|
|
443
466
|
function createDataViewNode(id, current, buffer) {
|
|
444
467
|
if (current.byteLength > MAX_TYPED_ARRAY_LENGTH) throw new SerovalUnsupportedTypeError(current);
|
|
@@ -984,8 +1007,7 @@ function createPromiseConstructorNode(ctx, id, resolver) {
|
|
|
984
1007
|
function getArrayBufferView(ctx, current) {
|
|
985
1008
|
if (!ctx.compactArrayBufferViews) return current;
|
|
986
1009
|
const buffer = new Uint8Array(current.buffer, current.byteOffset, current.byteLength).slice().buffer;
|
|
987
|
-
|
|
988
|
-
return new Constructor(buffer);
|
|
1010
|
+
return new (current instanceof DataView ? DataView : getTypedArrayConstructor(getTypedArrayName(current)))(buffer);
|
|
989
1011
|
}
|
|
990
1012
|
function encodeArrayBuffer(current) {
|
|
991
1013
|
if (typeof Buffer !== "undefined") return Buffer.from(current).toString("base64");
|
|
@@ -1271,24 +1293,6 @@ function resolvePlugins(plugins) {
|
|
|
1271
1293
|
}
|
|
1272
1294
|
}
|
|
1273
1295
|
//#endregion
|
|
1274
|
-
//#region src/core/utils/typed-array.ts
|
|
1275
|
-
function getTypedArrayConstructor(name) {
|
|
1276
|
-
switch (name) {
|
|
1277
|
-
case "Int8Array": return Int8Array;
|
|
1278
|
-
case "Int16Array": return Int16Array;
|
|
1279
|
-
case "Int32Array": return Int32Array;
|
|
1280
|
-
case "Uint8Array": return Uint8Array;
|
|
1281
|
-
case "Uint16Array": return Uint16Array;
|
|
1282
|
-
case "Uint32Array": return Uint32Array;
|
|
1283
|
-
case "Uint8ClampedArray": return Uint8ClampedArray;
|
|
1284
|
-
case "Float32Array": return Float32Array;
|
|
1285
|
-
case "Float64Array": return Float64Array;
|
|
1286
|
-
case "BigInt64Array": return BigInt64Array;
|
|
1287
|
-
case "BigUint64Array": return BigUint64Array;
|
|
1288
|
-
default: throw new SerovalUnknownTypedArrayError(name);
|
|
1289
|
-
}
|
|
1290
|
-
}
|
|
1291
|
-
//#endregion
|
|
1292
1296
|
//#region src/core/utils/valid-properties.ts
|
|
1293
1297
|
function isValidKey(key) {
|
|
1294
1298
|
switch (key) {
|
|
@@ -2153,7 +2157,10 @@ function serializeTemporal(ctx, node) {
|
|
|
2153
2157
|
throw new SerovalUnsupportedNodeError(node);
|
|
2154
2158
|
}
|
|
2155
2159
|
function serializeRegExp(ctx, node) {
|
|
2156
|
-
if (ctx.base.features & 32)
|
|
2160
|
+
if (ctx.base.features & 32) {
|
|
2161
|
+
if (node.c.includes("\\x3C")) return "new RegExp(\"" + node.c + "\",\"" + node.m + "\")";
|
|
2162
|
+
return "/" + deserializeString(node.c) + "/" + node.m;
|
|
2163
|
+
}
|
|
2157
2164
|
throw new SerovalUnsupportedNodeError(node);
|
|
2158
2165
|
}
|
|
2159
2166
|
function serializeSetItem(ctx, id, item) {
|