Socket
Socket
Sign inDemoInstall

node-domexception

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-domexception - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

7

index.js
/*! 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
}

3

package.json
{
"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 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc