File tree Expand file tree Collapse file tree 1 file changed +7
-25
lines changed Expand file tree Collapse file tree 1 file changed +7
-25
lines changed Original file line number Diff line number Diff line change @@ -462,32 +462,14 @@ function getDocument(src = {}) {
462
462
if ( ! url ) {
463
463
throw new Error ( "getDocument - no `url` parameter provided." ) ;
464
464
}
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
489
472
: PDFNetworkStream ;
490
- }
491
473
492
474
networkStream = new NetworkStream ( {
493
475
url,
You can’t perform that action at this time.
0 commit comments