noargs-wrapper 1.0.0 → 1.1.1
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.
- package/index.js +8 -10
- package/package.json +5 -3
package/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
var nAry = require('ramda.nary')
|
|
2
|
+
var zero = require('number-zero')
|
|
3
|
+
var isFunction = require('@is-(unknown)/is-function')
|
|
4
|
+
var throwup = require('get-intrinsic')('%ThrowTypeError%')
|
|
5
|
+
var not = require("es-logical-not-operator")
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Wrap a function so it's always called with no arguments.
|
|
@@ -10,12 +10,10 @@ const $Array = GetIntrinsic('%Array%')
|
|
|
10
10
|
* @returns {Function} - A new function that ignores all passed arguments
|
|
11
11
|
*/
|
|
12
12
|
function noArgsWrapper(fn) {
|
|
13
|
-
if (
|
|
14
|
-
|
|
13
|
+
if (not(isFunction(fn))) {
|
|
14
|
+
throwup()
|
|
15
15
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return ignoreArgument(fn, ...ignoreAll)
|
|
16
|
+
return nAry(zero, fn)
|
|
19
17
|
}
|
|
20
18
|
|
|
21
19
|
module.exports = noArgsWrapper
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "noargs-wrapper",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Wrap a function to always call it with no arguments, ignoring all arguments passed in.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"function",
|
|
@@ -23,8 +23,10 @@
|
|
|
23
23
|
"type": "commonjs",
|
|
24
24
|
"main": "index.js",
|
|
25
25
|
"dependencies": {
|
|
26
|
+
"@is-(unknown)/is-function": "^1.0.3",
|
|
27
|
+
"es-logical-not-operator": "^1.0.0",
|
|
26
28
|
"get-intrinsic": "^1.3.0",
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
+
"number-zero": "^1.0.3",
|
|
30
|
+
"ramda.nary": "^0.26.1"
|
|
29
31
|
}
|
|
30
32
|
}
|