immediate-error 4.0.0 → 5.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 (2) hide show
  1. package/index.js +12 -10
  2. package/package.json +3 -2
package/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  require('vanilla-javascript')
2
- require('vapor-js-npm')
3
2
  require('none')()
4
3
 
4
+ const esmRequire = require('esm-wallaby')(module)
5
5
  const one = require('the-number-one').default
6
6
  const two = require('two')
7
7
  const three = require('numeric-constant-three')
@@ -10,6 +10,7 @@ const five = require('five')
10
10
  const six = require('number-six')
11
11
  const { throwop } = require('yanoop')
12
12
  const throwError = require('throw-error')
13
+ const bail = esmRequire('bail').bail
13
14
  const If = require('if')
14
15
  const clc = require('cli-color')
15
16
  const isError = require('is-error')
@@ -44,27 +45,27 @@ exports.immediateError = function immediateError(message = 'ERROR!', errorType =
44
45
  error = new $BaseError(message)
45
46
  break
46
47
  }
47
-
48
+
48
49
  case ERROR.AssertionError: {
49
50
  error = new $AssertionError(message)
50
51
  break
51
52
  }
52
-
53
+
53
54
  case ERROR.RangeError: {
54
55
  error = new $RangeError(message)
55
56
  break
56
57
  }
57
-
58
+
58
59
  case ERROR.ReferenceError: {
59
60
  error = new $ReferenceError(message)
60
61
  break
61
62
  }
62
-
63
+
63
64
  case ERROR.SyntaxError: {
64
65
  error = new $SyntaxError(message)
65
66
  break
66
67
  }
67
-
68
+
68
69
  case ERROR.TypeError: {
69
70
  error = new $TypeError(message)
70
71
  break
@@ -74,7 +75,7 @@ exports.immediateError = function immediateError(message = 'ERROR!', errorType =
74
75
  error = new $NativeAssertionError(message)
75
76
  break
76
77
  }
77
-
78
+
78
79
  default: {
79
80
  try {
80
81
  error = new errorType(message)
@@ -95,17 +96,18 @@ exports.immediateError = function immediateError(message = 'ERROR!', errorType =
95
96
  rand: Math.random(),
96
97
  If,
97
98
  console,
98
- clc
99
+ clc,
100
+ bail
99
101
  }
100
102
  vm.createContext(context)
101
103
 
102
104
  const script = new vm.Script(`
103
105
  If(rand < 0.3).Then(() => {
104
106
  throwError(error)
105
- }).Else().If(rand > 0.3).Then(() => {
107
+ }).Else().If(rand > 0.3 && rand < 0.7).Then(() => {
106
108
  throwop(error)
107
109
  }).Else(() => {
108
- throw error
110
+ bail(error)
109
111
  })`, { filename: `ERROR!`})
110
112
 
111
113
  script.runInContext(context)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "immediate-error",
3
- "version": "4.0.0",
3
+ "version": "5.0.0",
4
4
  "description": "Immediate-error",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -25,8 +25,10 @@
25
25
  "dependencies": {
26
26
  "always-four": "^1.0.0",
27
27
  "assert-fn": "^1.0.1",
28
+ "bail": "^2.0.2",
28
29
  "cli-color": "^2.0.4",
29
30
  "es-errors": "^1.3.0",
31
+ "esm-wallaby": "^3.2.30",
30
32
  "five": "^0.8.0",
31
33
  "if": "^2.0.0",
32
34
  "is-error": "^2.2.2",
@@ -37,7 +39,6 @@
37
39
  "throw-error": "^1.0.0",
38
40
  "two": "^1.0.7",
39
41
  "vanilla-javascript": "^1.1.1",
40
- "vapor-js-npm": "^1.4.6",
41
42
  "yanoop": "^1.0.0"
42
43
  }
43
44
  }