File tree 1 file changed +7
-25
lines changed 1 file changed +7
-25
lines changed Original file line number Diff line number Diff line change @@ -462,32 +462,14 @@ function getDocument(src = {}) {
462462 if ( ! url ) {
463463 throw new Error ( "getDocument - no `url` parameter provided." ) ;
464464 }
465- let NetworkStream ;
466-
467- if (
468- typeof PDFJSDev !== "undefined" &&
469- PDFJSDev . test ( "GENERIC" ) &&
470- isNodeJS
471- ) {
472- if ( isValidFetchUrl ( url ) ) {
473- if (
474- typeof fetch === "undefined" ||
475- typeof Response === "undefined" ||
476- ! ( "body" in Response . prototype )
477- ) {
478- throw new Error (
479- "getDocument - the Fetch API was disabled in Node.js, see `--no-experimental-fetch`."
480- ) ;
481- }
482- NetworkStream = PDFFetchStream ;
483- } else {
484- NetworkStream = PDFNodeStream ;
485- }
486- } else {
487- NetworkStream = isValidFetchUrl ( url )
488- ? PDFFetchStream
465+ // eslint-disable-next-line no-nested-ternary
466+ const NetworkStream = isValidFetchUrl ( url )
467+ ? PDFFetchStream
468+ : typeof PDFJSDev !== "undefined" &&
469+ PDFJSDev . test ( "GENERIC" ) &&
470+ isNodeJS
471+ ? PDFNodeStream
489472 : PDFNetworkStream ;
490- }
491473
492474 networkStream = new NetworkStream ( {
493475 url,
You can’t perform that action at this time.
0 commit comments