From 3e155bdbb94d49994e1fe987b2984bde4fe6bd52 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Fri, 1 Jan 2016 16:17:55 -0600 Subject: [PATCH] Move `_.bindAll` to the utility category. --- lodash.js | 66 +++++++++++++++++++++++++++---------------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/lodash.js b/lodash.js index 4ddc9fcc2..e54014049 100644 --- a/lodash.js +++ b/lodash.js @@ -8240,39 +8240,6 @@ return createWrapper(func, bitmask, thisArg, partials, holders); }); - /** - * Binds methods of an object to the object itself, overwriting the existing - * method. - * - * **Note:** This method doesn't set the "length" property of bound functions. - * - * @static - * @memberOf _ - * @category Function - * @param {Object} object The object to bind and assign the bound methods to. - * @param {...(string|string[])} methodNames The object method names to bind, - * specified individually or in arrays. - * @returns {Object} Returns `object`. - * @example - * - * var view = { - * 'label': 'docs', - * 'onClick': function() { - * console.log('clicked ' + this.label); - * } - * }; - * - * _.bindAll(view, 'onClick'); - * jQuery(element).on('click', view.onClick); - * // => logs 'clicked docs' when clicked - */ - var bindAll = rest(function(object, methodNames) { - arrayEach(baseFlatten(methodNames), function(key) { - object[key] = bind(object[key], object); - }); - return object; - }); - /** * Creates a function that invokes the method at `object[key]` and prepends * any additional `_.bindKey` arguments to those provided to the bound function. @@ -12820,6 +12787,39 @@ } }); + /** + * Binds methods of an object to the object itself, overwriting the existing + * method. + * + * **Note:** This method doesn't set the "length" property of bound functions. + * + * @static + * @memberOf _ + * @category Utility + * @param {Object} object The object to bind and assign the bound methods to. + * @param {...(string|string[])} methodNames The object method names to bind, + * specified individually or in arrays. + * @returns {Object} Returns `object`. + * @example + * + * var view = { + * 'label': 'docs', + * 'onClick': function() { + * console.log('clicked ' + this.label); + * } + * }; + * + * _.bindAll(view, 'onClick'); + * jQuery(element).on('click', view.onClick); + * // => logs 'clicked docs' when clicked + */ + var bindAll = rest(function(object, methodNames) { + arrayEach(baseFlatten(methodNames), function(key) { + object[key] = bind(object[key], object); + }); + return object; + }); + /** * Creates a function that invokes the predicate properties of `source` with * the corresponding property values of a given object, returning `true` if