Mirror: A Node.js fetch shim using built-in Request, Response, and Headers (but without native fetch)
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: Protect against missing `Symbol.toStringTag` (#19)

authored by

Phil Pluckthun and committed by
GitHub
25e9ebcd 02c74c23

+7 -2
+5
.changeset/wild-beers-repeat.md
··· 1 + --- 2 + 'fetch-nodeshim': patch 3 + --- 4 + 5 + Protect against missing `Symbol.toStringTag`
+2 -2
src/body.ts
··· 77 77 typeof object.stream === 'function' && 78 78 typeof object.constructor === 'function' 79 79 ) { 80 - const tag = object[Symbol.toStringTag]; 81 - return tag.startsWith('Blob') || tag.startsWith('File'); 80 + const tag = object[Symbol.toStringTag] as string | undefined; 81 + return !!tag && (tag.startsWith('Blob') || tag.startsWith('File')); 82 82 } else { 83 83 return false; 84 84 }