node-domexception
Advanced tools
Comparing version 2.0.0 to 2.0.1
/*! node-domexception. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */ | ||
const DOMException = globalThis.DOMException ??= (() => { | ||
globalThis.DOMException ??= (() => { | ||
try { atob(0) } catch (err) { return err.constructor } | ||
})() | ||
export { | ||
DOMException, | ||
DOMException as default | ||
} |
{ | ||
"name": "node-domexception", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "An implementation of the DOMException class from NodeJS", | ||
"main": "index.js", | ||
"type": "module", | ||
"repository": { | ||
@@ -8,0 +7,0 @@ "type": "git", |
@@ -11,6 +11,6 @@ # DOMException | ||
```bash | ||
# esm-only (makes use of atob | require NodeJS 16+) | ||
# makes use of atob | require NodeJS 16+ | ||
npm install node-domexception | ||
# cjs (makes use of worker_thread | require NodeJS 10+) | ||
# makes use of worker_thread | require NodeJS 10+ | ||
npm install node-domexception@1.x | ||
@@ -21,17 +21,13 @@ ``` | ||
which also binds it to NodeJS v16+ (at which point `atob` become globally available). | ||
This NodeJS dependency free solution is better for cross env platform solutions. | ||
if you are stuck with cjs then you can only do async `import()` from cjs projects. | ||
This NodeJS dependency/export free solution is better for cross env platform solutions. | ||
it no longer have any cjs or esm exports and it's attached to globalThis.DOMException only if needed. | ||
v1.x used a older [tech](https://github.com/jimmywarting/node-domexception/blob/c2024740c6502f80ad2f62c8ad58d6cec61b05f3/index.js) which depended on `node:worker_threads` to obtain | ||
`DOMException` which works all the way down to v10.5 | ||
v1.x was also written in cjs, so if you want to support NodeJS v10.5+ or can't | ||
use ESM then install v1.x | ||
`DOMException` which works all the way down to NodeJS v10.5+ | ||
If are not supporting older NodeJS versions (before v17) then you won't need this package at all. | ||
If you are not supporting older NodeJS versions (before v17) then you won't need this package at all. | ||
My personal recommendation is that you update to a newer NodeJS version. | ||
This pkg will likely be deprecated once v18 becomes LTS | ||
```js | ||
import { DOMException } from 'node-domexception' | ||
// it also act as a pollyfill (so you can use globalThis.DOMException) | ||
import 'node-domexception' | ||
@@ -38,0 +34,0 @@ |
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
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
1
5167
4
71
No