* Simple bind, faster than native
(fn, ctx)
| 118 | * Simple bind, faster than native |
| 119 | */ |
| 120 | function bind (fn, ctx) { |
| 121 | function boundFn (a) { |
| 122 | var l = arguments.length; |
| 123 | return l |
| 124 | ? l > 1 |
| 125 | ? fn.apply(ctx, arguments) |
| 126 | : fn.call(ctx, a) |
| 127 | : fn.call(ctx) |
| 128 | } |
| 129 | // record original fn length |
| 130 | boundFn._length = fn.length; |
| 131 | return boundFn |
| 132 | } |
| 133 | |
| 134 | /** |
| 135 | * Convert an Array-like object to a real Array. |