seroval 0.11.5 → 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.
@@ -669,35 +669,43 @@ async function parseObject(
669
669
  }
670
670
  // Web APIs
671
671
  if (ctx.features & Feature.WebAPI) {
672
- switch (currentClass) {
673
- case URL:
674
- return createURLNode(id, current as unknown as URL);
675
- case URLSearchParams:
676
- return createURLSearchParamsNode(id, current as unknown as URLSearchParams);
677
- case Blob:
678
- return createBlobNode(ctx, id, current as unknown as Blob);
679
- case File:
680
- return createFileNode(ctx, id, current as unknown as File);
681
- case Headers:
682
- return generateHeadersNode(ctx, id, current as unknown as Headers);
683
- case FormData:
684
- return generateFormDataNode(ctx, id, current as unknown as FormData);
685
- case Request:
686
- return generateRequestNode(ctx, id, current as unknown as Request);
687
- case Response:
688
- return generateResponseNode(ctx, id, current as unknown as Response);
689
- case Event:
690
- return generateEventNode(ctx, id, current as unknown as Event);
691
- case CustomEvent:
692
- return generateCustomEventNode(ctx, id, current as unknown as CustomEvent);
693
- case DOMException:
694
- return createDOMExceptionNode(id, current as unknown as DOMException);
695
- default:
696
- break;
672
+ if (typeof URL !== 'undefined' && currentClass === URL) {
673
+ return createURLNode(id, current as unknown as URL);
674
+ }
675
+ if (typeof URLSearchParams !== 'undefined' && currentClass === URLSearchParams) {
676
+ return createURLSearchParamsNode(id, current as unknown as URLSearchParams);
677
+ }
678
+ if (typeof Blob !== 'undefined' && currentClass === Blob) {
679
+ return createBlobNode(ctx, id, current as unknown as Blob);
680
+ }
681
+ if (typeof File !== 'undefined' && currentClass === File) {
682
+ return createFileNode(ctx, id, current as unknown as File);
683
+ }
684
+ if (typeof Headers !== 'undefined' && currentClass === Headers) {
685
+ return generateHeadersNode(ctx, id, current as unknown as Headers);
686
+ }
687
+ if (typeof FormData !== 'undefined' && currentClass === FormData) {
688
+ return generateFormDataNode(ctx, id, current as unknown as FormData);
689
+ }
690
+ if (typeof Request !== 'undefined' && currentClass === Request) {
691
+ return generateRequestNode(ctx, id, current as unknown as Request);
692
+ }
693
+ if (typeof Response !== 'undefined' && currentClass === Response) {
694
+ return generateResponseNode(ctx, id, current as unknown as Response);
695
+ }
696
+ if (typeof Event !== 'undefined' && currentClass === Event) {
697
+ return generateEventNode(ctx, id, current as unknown as Event);
698
+ }
699
+ if (typeof CustomEvent !== 'undefined' && currentClass === CustomEvent) {
700
+ return generateCustomEventNode(ctx, id, current as unknown as CustomEvent);
701
+ }
702
+ if (typeof DOMException !== 'undefined' && currentClass === DOMException) {
703
+ return createDOMExceptionNode(id, current as unknown as DOMException);
697
704
  }
698
705
  }
699
706
  if (
700
707
  (ctx.features & Feature.AggregateError)
708
+ && typeof AggregateError !== 'undefined'
701
709
  && (currentClass === AggregateError || current instanceof AggregateError)
702
710
  ) {
703
711
  return generateAggregateErrorNode(ctx, id, current as unknown as AggregateError);
@@ -555,31 +555,32 @@ function parseObject(
555
555
  }
556
556
  // Web APIs
557
557
  if (ctx.features & Feature.WebAPI) {
558
- switch (currentClass) {
559
- case URL:
560
- return createURLNode(id, current as unknown as URL);
561
- case URLSearchParams:
562
- return createURLSearchParamsNode(id, current as unknown as URLSearchParams);
563
- case Headers:
564
- return generateHeadersNode(ctx, id, current as unknown as Headers);
565
- case FormData:
566
- return generateFormDataNode(ctx, id, current as unknown as FormData);
567
- case Event:
568
- return generateEventNode(ctx, id, current as unknown as Event);
569
- case CustomEvent:
570
- return generateCustomEventNode(ctx, id, current as unknown as CustomEvent);
571
- case DOMException:
572
- return createDOMExceptionNode(id, current as unknown as DOMException);
573
- default:
574
- break;
558
+ if (typeof URL !== 'undefined' && currentClass === URL) {
559
+ return createURLNode(id, current as unknown as URL);
560
+ }
561
+ if (typeof URLSearchParams !== 'undefined' && currentClass === URLSearchParams) {
562
+ return createURLSearchParamsNode(id, current as unknown as URLSearchParams);
563
+ }
564
+ if (typeof Headers !== 'undefined' && currentClass === Headers) {
565
+ return generateHeadersNode(ctx, id, current as unknown as Headers);
566
+ }
567
+ if (typeof FormData !== 'undefined' && currentClass === FormData) {
568
+ return generateFormDataNode(ctx, id, current as unknown as FormData);
569
+ }
570
+ if (typeof Event !== 'undefined' && currentClass === Event) {
571
+ return generateEventNode(ctx, id, current as unknown as Event);
572
+ }
573
+ if (typeof CustomEvent !== 'undefined' && currentClass === CustomEvent) {
574
+ return generateCustomEventNode(ctx, id, current as unknown as CustomEvent);
575
+ }
576
+ if (typeof DOMException !== 'undefined' && currentClass === DOMException) {
577
+ return createDOMExceptionNode(id, current as unknown as DOMException);
575
578
  }
576
579
  }
577
580
  if (
578
581
  (ctx.features & Feature.AggregateError)
579
- && (
580
- currentClass === AggregateError
581
- || current instanceof AggregateError
582
- )
582
+ && typeof AggregateError !== 'undefined'
583
+ && (currentClass === AggregateError || current instanceof AggregateError)
583
584
  ) {
584
585
  return generateAggregateErrorNode(ctx, id, current as unknown as AggregateError);
585
586
  }