throw-error2 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +2 -0
  2. package/index.js +9 -0
  3. package/package.json +27 -0
package/README.md ADDED
@@ -0,0 +1,2 @@
1
+ # throw-error2
2
+ [throw-error](https://npm.im/throw-error) without vulnerabilities.
package/index.js ADDED
@@ -0,0 +1,9 @@
1
+ "use strict"
2
+
3
+ const is = require("@10xly/is-instance-of")
4
+ const Error = require("es-error-intrinsics/Error")
5
+
6
+ module.exports = (x) => {
7
+ if (is(x, Error)) throw x
8
+ return x
9
+ }
package/package.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "throw-error2",
3
+ "version": "1.0.0",
4
+ "description": "Throw something if it's an Error, otherwise returns it",
5
+ "keywords": [
6
+ "Error"
7
+ ],
8
+ "homepage": "https://github.com/10xly/throw-error2#readme",
9
+ "bugs": {
10
+ "url": "https://github.com/10xly/throw-error2/issues"
11
+ },
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "git+https://github.com/10xly/throw-error2.git"
15
+ },
16
+ "license": "MIT",
17
+ "author": "10x'ly",
18
+ "type": "commonjs",
19
+ "main": "index.js",
20
+ "scripts": {
21
+ "test": "echo \"Error: no test specified\" && exit 1"
22
+ },
23
+ "dependencies": {
24
+ "@10xly/is-instance-of": "^1.0.0",
25
+ "es-error-intrinsics": "^1.0.1"
26
+ }
27
+ }