seroval 0.11.4 → 0.11.6

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.
@@ -740,12 +740,11 @@ function isIterable(ctx, value) {
740
740
  return false;
741
741
  }
742
742
  if (ctx.features & 8192 /* WebAPI */) {
743
- switch (currentClass) {
744
- case Headers:
745
- case File:
746
- return false;
747
- default:
748
- break;
743
+ if (typeof Headers !== "undefined" && currentClass === Headers) {
744
+ return false;
745
+ }
746
+ if (typeof File !== "undefined" && currentClass === File) {
747
+ return false;
749
748
  }
750
749
  }
751
750
  if (ctx.features & 1024 /* Symbol */) {
@@ -1407,40 +1406,47 @@ async function parseObject(ctx, current) {
1407
1406
  current
1408
1407
  );
1409
1408
  }
1409
+ if (ctx.features & 256 /* Promise */ && (currentClass === Promise || current instanceof Promise)) {
1410
+ return generatePromiseNode(ctx, id, current);
1411
+ }
1410
1412
  if (ctx.features & 8192 /* WebAPI */) {
1411
- switch (currentClass) {
1412
- case URL:
1413
- return createURLNode(id, current);
1414
- case URLSearchParams:
1415
- return createURLSearchParamsNode(id, current);
1416
- case Blob:
1417
- return createBlobNode(ctx, id, current);
1418
- case File:
1419
- return createFileNode(ctx, id, current);
1420
- case Headers:
1421
- return generateHeadersNode(ctx, id, current);
1422
- case FormData:
1423
- return generateFormDataNode(ctx, id, current);
1424
- case Request:
1425
- return generateRequestNode(ctx, id, current);
1426
- case Response:
1427
- return generateResponseNode(ctx, id, current);
1428
- case Event:
1429
- return generateEventNode(ctx, id, current);
1430
- case CustomEvent:
1431
- return generateCustomEventNode(ctx, id, current);
1432
- case DOMException:
1433
- return createDOMExceptionNode(id, current);
1434
- default:
1435
- break;
1413
+ if (typeof URL !== "undefined" && currentClass === URL) {
1414
+ return createURLNode(id, current);
1415
+ }
1416
+ if (typeof URLSearchParams !== "undefined" && currentClass === URLSearchParams) {
1417
+ return createURLSearchParamsNode(id, current);
1418
+ }
1419
+ if (typeof Blob !== "undefined" && currentClass === Blob) {
1420
+ return createBlobNode(ctx, id, current);
1421
+ }
1422
+ if (typeof File !== "undefined" && currentClass === File) {
1423
+ return createFileNode(ctx, id, current);
1424
+ }
1425
+ if (typeof Headers !== "undefined" && currentClass === Headers) {
1426
+ return generateHeadersNode(ctx, id, current);
1427
+ }
1428
+ if (typeof FormData !== "undefined" && currentClass === FormData) {
1429
+ return generateFormDataNode(ctx, id, current);
1430
+ }
1431
+ if (typeof Request !== "undefined" && currentClass === Request) {
1432
+ return generateRequestNode(ctx, id, current);
1433
+ }
1434
+ if (typeof Response !== "undefined" && currentClass === Response) {
1435
+ return generateResponseNode(ctx, id, current);
1436
+ }
1437
+ if (typeof Event !== "undefined" && currentClass === Event) {
1438
+ return generateEventNode(ctx, id, current);
1439
+ }
1440
+ if (typeof CustomEvent !== "undefined" && currentClass === CustomEvent) {
1441
+ return generateCustomEventNode(ctx, id, current);
1442
+ }
1443
+ if (typeof DOMException !== "undefined" && currentClass === DOMException) {
1444
+ return createDOMExceptionNode(id, current);
1436
1445
  }
1437
1446
  }
1438
- if (ctx.features & 1 /* AggregateError */ && (currentClass === AggregateError || current instanceof AggregateError)) {
1447
+ if (ctx.features & 1 /* AggregateError */ && typeof AggregateError !== "undefined" && (currentClass === AggregateError || current instanceof AggregateError)) {
1439
1448
  return generateAggregateErrorNode(ctx, id, current);
1440
1449
  }
1441
- if (ctx.features & 256 /* Promise */ && (currentClass === Promise || current instanceof Promise)) {
1442
- return generatePromiseNode(ctx, id, current);
1443
- }
1444
1450
  if (current instanceof Error) {
1445
1451
  return generateErrorNode(ctx, id, current);
1446
1452
  }
@@ -2900,26 +2906,29 @@ function parseObject2(ctx, current) {
2900
2906
  return generateSetNode2(ctx, id, current);
2901
2907
  }
2902
2908
  if (ctx.features & 8192 /* WebAPI */) {
2903
- switch (currentClass) {
2904
- case URL:
2905
- return createURLNode(id, current);
2906
- case URLSearchParams:
2907
- return createURLSearchParamsNode(id, current);
2908
- case Headers:
2909
- return generateHeadersNode2(ctx, id, current);
2910
- case FormData:
2911
- return generateFormDataNode2(ctx, id, current);
2912
- case Event:
2913
- return generateEventNode2(ctx, id, current);
2914
- case CustomEvent:
2915
- return generateCustomEventNode2(ctx, id, current);
2916
- case DOMException:
2917
- return createDOMExceptionNode(id, current);
2918
- default:
2919
- break;
2909
+ if (typeof URL !== "undefined" && currentClass === URL) {
2910
+ return createURLNode(id, current);
2911
+ }
2912
+ if (typeof URLSearchParams !== "undefined" && currentClass === URLSearchParams) {
2913
+ return createURLSearchParamsNode(id, current);
2914
+ }
2915
+ if (typeof Headers !== "undefined" && currentClass === Headers) {
2916
+ return generateHeadersNode2(ctx, id, current);
2917
+ }
2918
+ if (typeof FormData !== "undefined" && currentClass === FormData) {
2919
+ return generateFormDataNode2(ctx, id, current);
2920
+ }
2921
+ if (typeof Event !== "undefined" && currentClass === Event) {
2922
+ return generateEventNode2(ctx, id, current);
2923
+ }
2924
+ if (typeof CustomEvent !== "undefined" && currentClass === CustomEvent) {
2925
+ return generateCustomEventNode2(ctx, id, current);
2926
+ }
2927
+ if (typeof DOMException !== "undefined" && currentClass === DOMException) {
2928
+ return createDOMExceptionNode(id, current);
2920
2929
  }
2921
2930
  }
2922
- if (ctx.features & 1 /* AggregateError */ && (currentClass === AggregateError || current instanceof AggregateError)) {
2931
+ if (ctx.features & 1 /* AggregateError */ && typeof AggregateError !== "undefined" && (currentClass === AggregateError || current instanceof AggregateError)) {
2923
2932
  return generateAggregateErrorNode2(ctx, id, current);
2924
2933
  }
2925
2934
  if (current instanceof Error) {
@@ -3685,40 +3694,47 @@ async function parseObject3(ctx, current) {
3685
3694
  current
3686
3695
  );
3687
3696
  }
3697
+ if (ctx.features & 256 /* Promise */ && (currentClass === Promise || current instanceof Promise)) {
3698
+ return generatePromiseNode2(ctx, id, current);
3699
+ }
3688
3700
  if (ctx.features & 8192 /* WebAPI */) {
3689
- switch (currentClass) {
3690
- case URL:
3691
- return createURLNode(id, current);
3692
- case URLSearchParams:
3693
- return createURLSearchParamsNode(id, current);
3694
- case Blob:
3695
- return createBlobNode2(ctx, id, current);
3696
- case File:
3697
- return createFileNode2(ctx, id, current);
3698
- case Headers:
3699
- return generateHeadersNode3(ctx, id, current);
3700
- case FormData:
3701
- return generateFormDataNode3(ctx, id, current);
3702
- case Request:
3703
- return generateRequestNode2(ctx, id, current);
3704
- case Response:
3705
- return generateResponseNode2(ctx, id, current);
3706
- case Event:
3707
- return generateEventNode3(ctx, id, current);
3708
- case CustomEvent:
3709
- return generateCustomEventNode3(ctx, id, current);
3710
- case DOMException:
3711
- return createDOMExceptionNode(id, current);
3712
- default:
3713
- break;
3701
+ if (typeof URL !== "undefined" && currentClass === URL) {
3702
+ return createURLNode(id, current);
3703
+ }
3704
+ if (typeof URLSearchParams !== "undefined" && currentClass === URLSearchParams) {
3705
+ return createURLSearchParamsNode(id, current);
3706
+ }
3707
+ if (typeof Blob !== "undefined" && currentClass === Blob) {
3708
+ return createBlobNode2(ctx, id, current);
3709
+ }
3710
+ if (typeof File !== "undefined" && currentClass === File) {
3711
+ return createFileNode2(ctx, id, current);
3712
+ }
3713
+ if (typeof Headers !== "undefined" && currentClass === Headers) {
3714
+ return generateHeadersNode3(ctx, id, current);
3715
+ }
3716
+ if (typeof FormData !== "undefined" && currentClass === FormData) {
3717
+ return generateFormDataNode3(ctx, id, current);
3718
+ }
3719
+ if (typeof Request !== "undefined" && currentClass === Request) {
3720
+ return generateRequestNode2(ctx, id, current);
3721
+ }
3722
+ if (typeof Response !== "undefined" && currentClass === Response) {
3723
+ return generateResponseNode2(ctx, id, current);
3724
+ }
3725
+ if (typeof Event !== "undefined" && currentClass === Event) {
3726
+ return generateEventNode3(ctx, id, current);
3727
+ }
3728
+ if (typeof CustomEvent !== "undefined" && currentClass === CustomEvent) {
3729
+ return generateCustomEventNode3(ctx, id, current);
3730
+ }
3731
+ if (typeof DOMException !== "undefined" && currentClass === DOMException) {
3732
+ return createDOMExceptionNode(id, current);
3714
3733
  }
3715
3734
  }
3716
- if (ctx.features & 1 /* AggregateError */ && (currentClass === AggregateError || current instanceof AggregateError)) {
3735
+ if (ctx.features & 1 /* AggregateError */ && typeof AggregateError !== "undefined" && (currentClass === AggregateError || current instanceof AggregateError)) {
3717
3736
  return generateAggregateErrorNode3(ctx, id, current);
3718
3737
  }
3719
- if (ctx.features & 256 /* Promise */ && (currentClass === Promise || current instanceof Promise)) {
3720
- return generatePromiseNode2(ctx, id, current);
3721
- }
3722
3738
  if (current instanceof Error) {
3723
3739
  return generateErrorNode3(ctx, id, current);
3724
3740
  }
@@ -4923,38 +4939,44 @@ function parseObject4(ctx, current) {
4923
4939
  if (ctx.features & 512 /* Set */ && currentClass === Set) {
4924
4940
  return generateSetNode4(ctx, id, current);
4925
4941
  }
4942
+ if (ctx.features & 256 /* Promise */ && (currentClass === Promise || current instanceof Promise)) {
4943
+ return generatePromiseNode3(ctx, id, current);
4944
+ }
4926
4945
  if (ctx.features & 8192 /* WebAPI */) {
4927
- switch (currentClass) {
4928
- case URL:
4929
- return createURLNode(id, current);
4930
- case URLSearchParams:
4931
- return createURLSearchParamsNode(id, current);
4932
- case Headers:
4933
- return generateHeadersNode4(ctx, id, current);
4934
- case FormData:
4935
- return generateFormDataNode4(ctx, id, current);
4936
- case ReadableStream:
4937
- return generateReadableStreamNode(ctx, id, current);
4938
- case Request:
4939
- return generateRequestNode3(ctx, id, current);
4940
- case Response:
4941
- return generateResponseNode3(ctx, id, current);
4942
- case Event:
4943
- return generateEventNode4(ctx, id, current);
4944
- case CustomEvent:
4945
- return generateCustomEventNode4(ctx, id, current);
4946
- case DOMException:
4947
- return createDOMExceptionNode(id, current);
4948
- default:
4949
- break;
4946
+ if (typeof URL !== "undefined" && currentClass === URL) {
4947
+ return createURLNode(id, current);
4948
+ }
4949
+ if (typeof URLSearchParams !== "undefined" && currentClass === URLSearchParams) {
4950
+ return createURLSearchParamsNode(id, current);
4951
+ }
4952
+ if (typeof Headers !== "undefined" && currentClass === Headers) {
4953
+ return generateHeadersNode4(ctx, id, current);
4954
+ }
4955
+ if (typeof FormData !== "undefined" && currentClass === FormData) {
4956
+ return generateFormDataNode4(ctx, id, current);
4957
+ }
4958
+ if (typeof ReadableStream !== "undefined" && currentClass === ReadableStream) {
4959
+ return generateReadableStreamNode(ctx, id, current);
4960
+ }
4961
+ if (typeof Request !== "undefined" && currentClass === Request) {
4962
+ return generateRequestNode3(ctx, id, current);
4963
+ }
4964
+ if (typeof Response !== "undefined" && currentClass === Response) {
4965
+ return generateResponseNode3(ctx, id, current);
4966
+ }
4967
+ if (typeof Event !== "undefined" && currentClass === Event) {
4968
+ return generateEventNode4(ctx, id, current);
4969
+ }
4970
+ if (typeof CustomEvent !== "undefined" && currentClass === CustomEvent) {
4971
+ return generateCustomEventNode4(ctx, id, current);
4972
+ }
4973
+ if (typeof DOMException !== "undefined" && currentClass === DOMException) {
4974
+ return createDOMExceptionNode(id, current);
4950
4975
  }
4951
4976
  }
4952
- if (ctx.features & 1 /* AggregateError */ && (currentClass === AggregateError || current instanceof AggregateError)) {
4977
+ if (ctx.features & 1 /* AggregateError */ && typeof AggregateError !== "undefined" && (currentClass === AggregateError || current instanceof AggregateError)) {
4953
4978
  return generateAggregateErrorNode4(ctx, id, current);
4954
4979
  }
4955
- if (ctx.features & 256 /* Promise */ && (currentClass === Promise || current instanceof Promise)) {
4956
- return generatePromiseNode3(ctx, id, current);
4957
- }
4958
4980
  if (current instanceof Error) {
4959
4981
  return generateErrorNode4(ctx, id, current);
4960
4982
  }
@@ -5400,26 +5422,29 @@ function parseObject5(ctx, current) {
5400
5422
  return generateSetNode5(ctx, id, current);
5401
5423
  }
5402
5424
  if (ctx.features & 8192 /* WebAPI */) {
5403
- switch (currentClass) {
5404
- case URL:
5405
- return createURLNode(id, current);
5406
- case URLSearchParams:
5407
- return createURLSearchParamsNode(id, current);
5408
- case Headers:
5409
- return generateHeadersNode5(ctx, id, current);
5410
- case FormData:
5411
- return generateFormDataNode5(ctx, id, current);
5412
- case Event:
5413
- return generateEventNode5(ctx, id, current);
5414
- case CustomEvent:
5415
- return generateCustomEventNode5(ctx, id, current);
5416
- case DOMException:
5417
- return createDOMExceptionNode(id, current);
5418
- default:
5419
- break;
5425
+ if (typeof URL !== "undefined" && currentClass === URL) {
5426
+ return createURLNode(id, current);
5427
+ }
5428
+ if (typeof URLSearchParams !== "undefined" && currentClass === URLSearchParams) {
5429
+ return createURLSearchParamsNode(id, current);
5430
+ }
5431
+ if (typeof Headers !== "undefined" && currentClass === Headers) {
5432
+ return generateHeadersNode5(ctx, id, current);
5433
+ }
5434
+ if (typeof FormData !== "undefined" && currentClass === FormData) {
5435
+ return generateFormDataNode5(ctx, id, current);
5436
+ }
5437
+ if (typeof Event !== "undefined" && currentClass === Event) {
5438
+ return generateEventNode5(ctx, id, current);
5439
+ }
5440
+ if (typeof CustomEvent !== "undefined" && currentClass === CustomEvent) {
5441
+ return generateCustomEventNode5(ctx, id, current);
5442
+ }
5443
+ if (typeof DOMException !== "undefined" && currentClass === DOMException) {
5444
+ return createDOMExceptionNode(id, current);
5420
5445
  }
5421
5446
  }
5422
- if (ctx.features & 1 /* AggregateError */ && (currentClass === AggregateError || current instanceof AggregateError)) {
5447
+ if (ctx.features & 1 /* AggregateError */ && typeof AggregateError !== "undefined" && (currentClass === AggregateError || current instanceof AggregateError)) {
5423
5448
  return generateAggregateErrorNode5(ctx, id, current);
5424
5449
  }
5425
5450
  if (current instanceof Error) {