$
This commit is contained in:
19
node_modules/cumpa/index.next.js
generated
vendored
Normal file
19
node_modules/cumpa/index.next.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Similar to compose but performs from left-to-right function composition.<br/>
|
||||
* {@link https://30secondsofcode.org/function#composeright see also}
|
||||
* @param {...[function]} fns) - list of unary function
|
||||
* @returns {*} result of the computation
|
||||
*/
|
||||
export const composeRight = (...fns) => compose(...fns.reverse())
|
||||
|
||||
/**
|
||||
* Performs right-to-left function composition.<br/>
|
||||
* Use Array.prototype.reduce() to perform right-to-left function composition.<br/>
|
||||
* The last (rightmost) function can accept one or more arguments; the remaining functions must be unary.<br/>
|
||||
* {@link https://30secondsofcode.org/function#compose original source code}
|
||||
* @param {...[function]} fns) - list of unary function
|
||||
* @returns {*} result of the computation
|
||||
*/
|
||||
export default function compose(...fns) {
|
||||
return fns.reduce((f, g) => (...args) => f(g(...args)))
|
||||
}
|
Reference in New Issue
Block a user