* Lift the supplied function, creating a version of f that returns * promises, and accepts promises as arguments. * @param {function} f * @returns {Function} version of f that returns promises
(f)
| 104 | * @returns {Function} version of f that returns promises |
| 105 | */ |
| 106 | function lift(f) { |
| 107 | return function() { |
| 108 | for(var i=0, l=arguments.length, a=new Array(l); i<l; ++i) { |
| 109 | a[i] = arguments[i]; |
| 110 | } |
| 111 | return apply(f, this, a); |
| 112 | }; |
| 113 | } |
| 114 | |
| 115 | /** |
| 116 | * Call f in a future turn, with the supplied args, and return a promise |