twice-call-wrapper 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.
- package/README.md +30 -0
- package/index.js +5 -0
- package/package.json +27 -0
package/README.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# `twice-call-wrapper`
|
|
2
|
+
|
|
3
|
+
Returns a wrapper that calls a function twice, passing in the result of the first time into the second time.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Installation
|
|
7
|
+
```bash
|
|
8
|
+
$ npm i twice-call-wrapper
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```js
|
|
14
|
+
var calledtwice = require('twice-call-wrapper');
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
var double = v => v * 2; // a simple function that doubles a number
|
|
19
|
+
|
|
20
|
+
var doubleTwice = calledtwice(double);
|
|
21
|
+
|
|
22
|
+
console.log(doubleTwice(5)) // quadruples a number because it doubles it and then doubles it again, like double(double(5))
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## License
|
|
26
|
+
MIT Licensed
|
|
27
|
+
|
|
28
|
+
## Contributing
|
|
29
|
+
|
|
30
|
+
Contribute on the github repository! PRs and Issues are welcome.
|
package/index.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "twice-call-wrapper",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A small wrapper that calls a function twice: fn(fn(args))",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"function",
|
|
7
|
+
"wrapper",
|
|
8
|
+
"twice",
|
|
9
|
+
"compose",
|
|
10
|
+
"functional"
|
|
11
|
+
],
|
|
12
|
+
"homepage": "https://github.com/tj-commits/twice-call-wrapper#readme",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/tj-commits/twice-call-wrapper/issues"
|
|
15
|
+
},
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/tj-commits/twice-call-wrapper.git"
|
|
19
|
+
},
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"author": "Fox",
|
|
22
|
+
"type": "commonjs",
|
|
23
|
+
"main": "index.js",
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"compose-function": "^3.0.3"
|
|
26
|
+
}
|
|
27
|
+
}
|