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