noargs-wrapper 1.0.0 → 1.1.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 +1 -1
  2. package/index.js +3 -9
  3. package/package.json +2 -4
package/README.md CHANGED
@@ -10,7 +10,7 @@ $ npm install noargs-wrapper
10
10
 
11
11
  ## Usage
12
12
 
13
- This function takes in a function, and returns a wrapper that calls the passed-in function with no arguments, even if arguments are passed in to the wrapper. (unless the function passed in takes over 100 arguments)
13
+ This function takes in a function, and returns a wrapper that calls the passed-in function with no arguments, even if arguments are passed in to the wrapper.
14
14
 
15
15
  Here's an example:
16
16
 
package/index.js CHANGED
@@ -1,8 +1,4 @@
1
- const GetIntrinsic = require("get-intrinsic")
2
- const ignoreArgument = require("ignore-argument")
3
- const isFunction = require("is-function")
4
-
5
- const $Array = GetIntrinsic('%Array%')
1
+ var nAry = require('ramda.nary')
6
2
 
7
3
  /**
8
4
  * Wrap a function so it's always called with no arguments.
@@ -10,12 +6,10 @@ const $Array = GetIntrinsic('%Array%')
10
6
  * @returns {Function} - A new function that ignores all passed arguments
11
7
  */
12
8
  function noArgsWrapper(fn) {
13
- if (!isFunction(fn)) {
9
+ if (typeof fn !== 'function') {
14
10
  throw new TypeError("Expected a function")
15
11
  }
16
- const ignoreAll = $Array(100).fill(true)
17
-
18
- return ignoreArgument(fn, ...ignoreAll)
12
+ return nAry(0, fn)
19
13
  }
20
14
 
21
15
  module.exports = noArgsWrapper
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "noargs-wrapper",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
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,6 @@
23
23
  "type": "commonjs",
24
24
  "main": "index.js",
25
25
  "dependencies": {
26
- "get-intrinsic": "^1.3.0",
27
- "ignore-argument": "^0.1.1",
28
- "is-function": "^1.0.2"
26
+ "ramda.nary": "^0.26.1"
29
27
  }
30
28
  }