* Creates a function that is the composition of the provided functions, * where each function consumes the return value of the function that follows. * For example, composing the functions `f()`, `g()`, and `h()` produces `f(g(h()))`. * Each function is executed with the `this` bindin
()
| 40414 | * // => 'Hiya Penelope!' |
| 40415 | */ |
| 40416 | function compose() { |
| 40417 | var funcs = arguments, |
| 40418 | length = funcs.length; |
| 40419 | |
| 40420 | while (length--) { |
| 40421 | if (!isFunction(funcs[length])) { |
| 40422 | throw new TypeError; |
| 40423 | } |
| 40424 | } |
| 40425 | return function() { |
| 40426 | var args = arguments, |
| 40427 | length = funcs.length; |
| 40428 | |
| 40429 | while (length--) { |
| 40430 | args = [funcs[length].apply(this, args)]; |
| 40431 | } |
| 40432 | return args[0]; |
| 40433 | }; |
| 40434 | } |
| 40435 | |
| 40436 | /** |
| 40437 | * Creates a function which accepts one or more arguments of `func` that when |
nothing calls this directly
no test coverage detected