mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-02 16:17:50 +00:00
Remove semicolons.
This commit is contained in:
24
flow.js
24
flow.js
@@ -11,29 +11,29 @@
|
||||
* @example
|
||||
*
|
||||
* function square(n) {
|
||||
* return n * n;
|
||||
* return n * n
|
||||
* }
|
||||
*
|
||||
* const addSquare = flow([add, square]);
|
||||
* addSquare(1, 2);
|
||||
* const addSquare = flow([add, square])
|
||||
* addSquare(1, 2)
|
||||
* // => 9
|
||||
*/
|
||||
function flow(funcs) {
|
||||
const length = funcs ? funcs.length : 0;
|
||||
let index = length;
|
||||
const length = funcs ? funcs.length : 0
|
||||
let index = length
|
||||
while (index--) {
|
||||
if (typeof funcs[index] != 'function') {
|
||||
throw new TypeError('Expected a function');
|
||||
throw new TypeError('Expected a function')
|
||||
}
|
||||
}
|
||||
return function(...args) {
|
||||
let index = 0;
|
||||
let result = length ? funcs[index].apply(this, args) : args[0];
|
||||
let index = 0
|
||||
let result = length ? funcs[index].apply(this, args) : args[0]
|
||||
while (++index < length) {
|
||||
result = funcs[index].call(this, result);
|
||||
result = funcs[index].call(this, result)
|
||||
}
|
||||
return result;
|
||||
};
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
export default flow;
|
||||
export default flow
|
||||
|
||||
Reference in New Issue
Block a user