8056416f02817296833d1c3669ee7f72b4534995f7f0144a74147e27215e543b.json 1.2 KB

1
  1. {"ast":null,"code":"import arrayEach from './_arrayEach.js';\nimport baseAssignValue from './_baseAssignValue.js';\nimport bind from './bind.js';\nimport flatRest from './_flatRest.js';\nimport toKey from './_toKey.js';\n\n/**\n * Binds methods of an object to the object itself, overwriting the existing\n * method.\n *\n * **Note:** This method doesn't set the \"length\" property of bound functions.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Util\n * @param {Object} object The object to bind and assign the bound methods to.\n * @param {...(string|string[])} methodNames The object method names to bind.\n * @returns {Object} Returns `object`.\n * @example\n *\n * var view = {\n * 'label': 'docs',\n * 'click': function() {\n * console.log('clicked ' + this.label);\n * }\n * };\n *\n * _.bindAll(view, ['click']);\n * jQuery(element).on('click', view.click);\n * // => Logs 'clicked docs' when clicked.\n */\nvar bindAll = flatRest(function (object, methodNames) {\n arrayEach(methodNames, function (key) {\n key = toKey(key);\n baseAssignValue(object, key, bind(object[key], object));\n });\n return object;\n});\nexport default bindAll;","map":null,"metadata":{},"sourceType":"module","externalDependencies":[]}