@@ -29,9 +29,10 @@ function, [unspread] combines all parameters into the first parameter (array),
29
29
[ wrap] adds ignored parameters to the left/right of a function's parameters, and
30
30
[ unwrap] removes common prefix and suffix parameters to a function (by passing
31
31
known constant values as prefix/suffix). If you want some ** functional**
32
- ** behavior** , [ compose] , [ composeRight] , [ curry] , and [ curryRight] can be used. If
33
- you are unfamiliar, [ Haskell] is a great purely functional language, and there
34
- is great [ haskell beginner guide] to learn from.
32
+ ** behavior** , [ compose] , [ composeRight] , [ curry] , and [ curryRight] can be used.
33
+ [ composeRight] is also known as [ pipe-forward operator] or [ function chaining] .
34
+ If you are unfamiliar, [ Haskell] is a great purely functional language, and
35
+ there is great [ haskell beginner guide] to learn from.
35
36
36
37
To control invocation ** time** of a function, use [ delay] . A function can be
37
38
** rate controlled** with [ limitUse] , [ debounce] , [ debounceEarly] , [ throttle] ,
@@ -47,16 +48,18 @@ refreshing a webpage]. Except [limitUse], all *rate/time control* methods can be
47
48
* flushed* (` flush() ` ) to invoke the target function immediately, or * cleared*
48
49
(` clear() ` ) to disable invocation of the target function.
49
50
50
- In addition, use [ is] , [ isAsync] , [ isGenerator] , [ signature] , [ name] ,
51
- [ parameters ] , and [ arity] to obtain metadata (about) information on a function.
52
- A few generic functions are also included: [ ARGUMENTS ] , [ NOOP ] , [ IDENTITY ] ,
53
- [ COMPARE] .
51
+ In addition, [ is] , [ isAsync] , [ isGenerator] , [ signature] , [ name] , [ parameters ] ,
52
+ and [ arity] obtain metadata (about) information on a function. To attach a
53
+ ` this ` to a function, use [ bind ] . A few generic functions are also included:
54
+ [ ARGUMENTS ] , [ NOOP ] , [ IDENTITY ] , [ COMPARE] .
54
55
55
56
This package is available in both * Node.js* and * Web* formats. The web format is
56
57
exposed as ` extra_function ` standalone variable and can be loaded from [ jsDelivr CDN] .
57
58
58
59
[ (1) ] : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Functions
59
60
[ lambda calculus ] : https://en.wikipedia.org/wiki/Lambda_calculus
61
+ [ pipe-forward operator ] : https://stackoverflow.com/questions/1457140/haskell-composition-vs-fs-pipe-forward-operator
62
+ [ function chaining ] : https://www.npmjs.com/package/chain-function
60
63
[ Haskell ] : https://www.haskell.org
61
64
[ haskell beginner guide ] : http://learnyouahaskell.com
62
65
[ constantly refreshing a webpage ] : https://tenor.com/view/social-network-mark-zuckerberg-refresh-movie-jesse-eisenberg-gif-12095762
@@ -72,17 +75,17 @@ const funcxion = require('extra-function');
72
75
// import * as funcxion from "extra-function";
73
76
// import * as funcxion from "https://unpkg.com/extra-function/index.mjs"; (deno)
74
77
75
- funcxion .sum ( 1 , 2 , 3 , 4 );
76
- // → 10
78
+ funcxion .composeRight ( x => x * x, x => x + 2 );
79
+ // → 102
77
80
78
- funcxion .median ( 1 , 7 , 8 );
81
+ funcxion .curry (( x , y ) => x + y );
79
82
// → 7
80
83
81
- funcxion .variance ( 1 , 2 , 3 , 4 );
84
+ funcxion .unspread ( Math . max );
82
85
// → 1.25
83
86
84
- funcxion .lcm ( 2 , 3 , 4 );
85
- // → 12
87
+ funcxion .parameters (( x , y ) => x + y );
88
+ // → [ 'x', 'y' ]
86
89
```
87
90
88
91
<br >
@@ -99,6 +102,7 @@ funcxion.lcm(2, 3, 4);
99
102
| [ COMPARE] | Compare two values. |
100
103
| | |
101
104
| [ is] | Check if value is a function. |
105
+ | [ isAsync] | Check if value is an async function. |
102
106
| [ isGenerator] | Check if value is a generator function. |
103
107
| [ signature] | Get the signature of a function. |
104
108
| [ name] | Get the name of a function. |
@@ -136,20 +140,47 @@ funcxion.lcm(2, 3, 4);
136
140
137
141
## References
138
142
139
- - [ Modulo operation] ( https://en.wikipedia.org/wiki/Modulo_operation )
143
+ - [ MDN Web docs] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference )
144
+ - [ Lodash documentation] ( https://lodash.com/docs/4.17.15 )
145
+ - [ Underscore.js documentation] ( https://underscorejs.org/ )
146
+ - [ Function composition] ( https://en.wikipedia.org/wiki/Function_composition )
147
+ - [ Debouncing and Throttling Explained Through Examples by David Corbacho] ( https://css-tricks.com/debouncing-throttling-explained-examples/ )
148
+ - [ Learn You a Haskell for Great Good!: Higher order functions by Miran Lipovaca] ( http://learnyouahaskell.com/higher-order-functions )
149
+ - [ How to know if a function is async?] ( https://stackoverflow.com/questions/38508420/how-to-know-if-a-function-is-async )
150
+ - [ Check if function is a generator] ( https://stackoverflow.com/questions/16754956/check-if-function-is-a-generator )
151
+ - [ Haskell composition (.) vs F#'s pipe forward operator (|>)] ( https://stackoverflow.com/questions/1457140/haskell-composition-vs-fs-pipe-forward-operator )
152
+ - [ JavaScript Detect Async Function by David Walsh] ( https://davidwalsh.name/javascript-detect-async-function )
153
+ - [ is-function package by Stephen Sugden] ( https://www.npmjs.com/package/is-function )
154
+ - [ is-async-function package by Jordan Harband] ( https://www.npmjs.com/package/is-async-function )
155
+ - [ is-callback-function package by Charlike Mike Reagent] ( https://www.npmjs.com/package/is-callback-function )
156
+ - [ is-generator-fn package by Sindre Sorhus] ( https://www.npmjs.com/package/is-generator-fn )
157
+ - [ is-generator-function package by Jordan Harband] ( https://www.npmjs.com/package/is-generator-function )
158
+ - [ fn-name package by Sindre Sorhus] ( https://www.npmjs.com/package/fn-name )
159
+ - [ memoizee package by Mariusz Nowak] ( https://www.npmjs.com/package/memoizee )
160
+ - [ memoizerific package by @thinkloop ] ( https://www.npmjs.com/package/memoizerific )
161
+ - [ compose-function package by Christoph Hermann] ( https://www.npmjs.com/package/compose-function )
162
+ - [ chain-function package by Jason Quense] ( https://www.npmjs.com/package/chain-function )
163
+ - [ @spudly/curry package by Stephen Sorensen] ( https://www.npmjs.com/package/@spudly/curry )
164
+ - [ one-time package by Arnout Kazemier] ( https://www.npmjs.com/package/one-time )
165
+ - [ onetime package by Sindre Sorhus] ( https://www.npmjs.com/package/onetime )
166
+ - [ once package by Isaac Z. Schlueter] ( https://www.npmjs.com/package/once )
167
+ - [ debounce package by @component ] ( https://www.npmjs.com/package/debounce )
168
+ - [ throttle-debounce package by Ivan Nikolić] ( https://www.npmjs.com/package/throttle-debounce )
169
+ - [ throttleit package by @component ] ( https://www.npmjs.com/package/throttleit )
140
170
141
171
<br >
142
172
<br >
143
173
144
174
145
- [ ![ ] ( https://img.youtube.com/vi/dW8Cy6WrO94 /maxresdefault.jpg )] ( https://www.youtube.com/watch?v=dW8Cy6WrO94 ) <br >
175
+ [ ![ ] ( https://img.youtube.com/vi/vzfy4EKwG_Y /maxresdefault.jpg )] ( https://www.youtube.com/watch?v=vzfy4EKwG_Y ) <br >
146
176
147
177
148
178
[ ARGUMENTS ] : https://nodef.github.io/extra-function/modules.html#ARGUMENTS
149
179
[ NOOP ] : https://nodef.github.io/extra-function/modules.html#NOOP
150
180
[ IDENTITY ] : https://nodef.github.io/extra-function/modules.html#IDENTITY
151
181
[ COMPARE ] : https://nodef.github.io/extra-function/modules.html#COMPARE
152
182
[ is ] : https://nodef.github.io/extra-function/modules.html#is
183
+ [ isAsync ] : https://nodef.github.io/extra-function/modules.html#isAsync
153
184
[ isGenerator ] : https://nodef.github.io/extra-function/modules.html#isGenerator
154
185
[ signature ] : https://nodef.github.io/extra-function/modules.html#signature
155
186
[ name ] : https://nodef.github.io/extra-function/modules.html#name
0 commit comments