get-source
Advanced tools
Comparing version 2.0.10 to 2.0.11
@@ -153,13 +153,24 @@ "use strict"; | ||
module.exports.async = impl (function fetchFileAsync (path) { | ||
if (isBrowser) { | ||
return fetch (path).then (x => x.text ()) | ||
} else { | ||
return new Promise ((resolve, reject) => { | ||
nodeRequire ('fs').readFile (path, { encoding: 'utf8' }, (e, x) => { | ||
e ? reject (e) : resolve (x) | ||
}) | ||
}) | ||
return new Promise ((resolve, reject) => { | ||
if (isBrowser) { | ||
let xhr = new XMLHttpRequest () | ||
xhr.open ('GET', path) | ||
xhr.onreadystatechange = event => { | ||
if (xhr.readyState === 4) { | ||
if (xhr.status === 200) { | ||
resolve (xhr.responseText) | ||
} else { | ||
reject (new Error (xhr.statusText)) | ||
} | ||
} | ||
} | ||
}) | ||
xhr.send (null) | ||
} else { | ||
nodeRequire ('fs').readFile (path, { encoding: 'utf8' }, (e, x) => { | ||
e ? reject (e) : resolve (x) | ||
}) | ||
} | ||
}) | ||
}) | ||
/* ------------------------------------------------------------------------ */ |
{ | ||
"name": "get-source", | ||
"version": "2.0.10", | ||
"version": "2.0.11", | ||
"description": "Fetch source-mapped sources. Peek by file, line, column. Node & browsers. Sync & async.", | ||
@@ -5,0 +5,0 @@ "main": "get-source", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
35397
533
0