* Binds methods of an object to the object itself, overwriting the existing * method. Method names may be specified as individual arguments or as arrays * of method names. If no method names are provided all the function properties * of `object` will be bound. * * @static
(object)
| 40332 | * // => logs 'clicked docs', when the button is clicked |
| 40333 | */ |
| 40334 | function bindAll(object) { |
| 40335 | var funcs = arguments.length > 1 ? baseFlatten(arguments, true, false, 1) : functions(object), |
| 40336 | index = -1, |
| 40337 | length = funcs.length; |
| 40338 | |
| 40339 | while (++index < length) { |
| 40340 | var key = funcs[index]; |
| 40341 | object[key] = createWrapper(object[key], 1, null, null, object); |
| 40342 | } |
| 40343 | return object; |
| 40344 | } |
| 40345 | |
| 40346 | /** |
| 40347 | * Creates a function that, when called, invokes the method at `object[key]` |
nothing calls this directly
no test coverage detected