|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
399 bytes
|
| Line | |
|---|
| 1 | // Returns a function that is the composition of a list of functions, each
|
|---|
| 2 | // consuming the return value of the function that follows.
|
|---|
| 3 | export default function compose() {
|
|---|
| 4 | var args = arguments;
|
|---|
| 5 | var start = args.length - 1;
|
|---|
| 6 | return function() {
|
|---|
| 7 | var i = start;
|
|---|
| 8 | var result = args[start].apply(this, arguments);
|
|---|
| 9 | while (i--) result = args[i].call(this, result);
|
|---|
| 10 | return result;
|
|---|
| 11 | };
|
|---|
| 12 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.