lodash.bindall
Advanced tools
Comparing version 3.1.0 to 4.0.0
53
index.js
/** | ||
* lodash 3.1.0 (Custom Build) <https://lodash.com/> | ||
* Build: `lodash modern modularize exports="npm" -o ./` | ||
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> | ||
* Based on Underscore.js 1.8.2 <http://underscorejs.org/LICENSE> | ||
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors | ||
* lodash 4.0.0 (Custom Build) <https://lodash.com/> | ||
* Build: `lodash modularize exports="npm" -o ./` | ||
* Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/> | ||
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> | ||
* Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors | ||
* Available under MIT license <https://lodash.com/license> | ||
*/ | ||
var baseFlatten = require('lodash._baseflatten'), | ||
createWrapper = require('lodash._createwrapper'), | ||
functions = require('lodash.functions'), | ||
restParam = require('lodash.restparam'); | ||
var arrayEach = require('lodash._arrayeach'), | ||
baseFlatten = require('lodash._baseflatten'), | ||
bind = require('lodash.bind'), | ||
rest = require('lodash.rest'); | ||
/** Used to compose bitmasks for wrapper metadata. */ | ||
var BIND_FLAG = 1; | ||
/** | ||
* 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 enumerable function | ||
* properties, own and inherited, of `object` are bound. | ||
* method. | ||
* | ||
* **Note:** This method does not set the `length` property of bound functions. | ||
* **Note:** This method doesn't set the "length" property of bound functions. | ||
* | ||
* @static | ||
* @memberOf _ | ||
* @category Function | ||
* @category Util | ||
* @param {Object} object The object to bind and assign the bound methods to. | ||
* @param {...(string|string[])} [methodNames] The object method names to bind, | ||
* specified as individual method names or arrays of method names. | ||
* @param {...(string|string[])} methodNames The object method names to bind, | ||
* specified individually or in arrays. | ||
* @returns {Object} Returns `object`. | ||
@@ -41,16 +36,10 @@ * @example | ||
* | ||
* _.bindAll(view); | ||
* jQuery('#docs').on('click', view.onClick); | ||
* // => logs 'clicked docs' when the element is clicked | ||
* _.bindAll(view, 'onClick'); | ||
* jQuery(element).on('click', view.onClick); | ||
* // => logs 'clicked docs' when clicked | ||
*/ | ||
var bindAll = restParam(function(object, methodNames) { | ||
methodNames = methodNames.length ? baseFlatten(methodNames) : functions(object); | ||
var index = -1, | ||
length = methodNames.length; | ||
while (++index < length) { | ||
var key = methodNames[index]; | ||
object[key] = createWrapper(object[key], BIND_FLAG, object); | ||
} | ||
var bindAll = rest(function(object, methodNames) { | ||
arrayEach(baseFlatten(methodNames), function(key) { | ||
object[key] = bind(object[key], object); | ||
}); | ||
return object; | ||
@@ -57,0 +46,0 @@ }); |
{ | ||
"name": "lodash.bindall", | ||
"version": "3.1.0", | ||
"description": "The modern build of lodash’s `_.bindAll` as a module.", | ||
"version": "4.0.0", | ||
"description": "The lodash method `_.bindAll` exported as a module.", | ||
"homepage": "https://lodash.com/", | ||
"icon": "https://lodash.com/icon.svg", | ||
"license": "MIT", | ||
"keywords": "lodash, lodash-modularized, stdlib, util", | ||
"keywords": "lodash, lodash-modularized, stdlib, util, bindall", | ||
"author": "John-David Dalton <john.david.dalton@gmail.com> (http://allyoucanleet.com/)", | ||
"contributors": [ | ||
"John-David Dalton <john.david.dalton@gmail.com> (http://allyoucanleet.com/)", | ||
"Benjamin Tan <demoneaux@gmail.com> (https://d10.github.io/)", | ||
"Blaine Bublitz <blaine@iceddev.com> (http://www.iceddev.com/)", | ||
"Kit Cambridge <github@kitcambridge.be> (http://kitcambridge.be/)", | ||
"Blaine Bublitz <blaine@iceddev.com> (https://github.com/phated)", | ||
"Mathias Bynens <mathias@qiwi.be> (https://mathiasbynens.be/)" | ||
@@ -20,7 +18,7 @@ ], | ||
"dependencies": { | ||
"lodash._baseflatten": "^3.0.0", | ||
"lodash._createwrapper": "^3.0.0", | ||
"lodash.functions": "^3.0.0", | ||
"lodash.restparam": "^3.0.0" | ||
"lodash._arrayeach": "^3.0.0", | ||
"lodash._baseflatten": "^4.0.0", | ||
"lodash.bind": "^4.0.0", | ||
"lodash.rest": "^4.0.0" | ||
} | ||
} |
@@ -1,4 +0,4 @@ | ||
# lodash.bindall v3.1.0 | ||
# lodash.bindall v4.0.0 | ||
The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.bindAll` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. | ||
The [lodash](https://lodash.com/) method `_.bindAll` exported as a [Node.js](https://nodejs.org/) module. | ||
@@ -8,3 +8,2 @@ ## Installation | ||
Using npm: | ||
```bash | ||
@@ -15,4 +14,3 @@ $ {sudo -H} npm i -g npm | ||
In Node.js/io.js: | ||
In Node.js: | ||
```js | ||
@@ -22,2 +20,2 @@ var bindAll = require('lodash.bindall'); | ||
See the [documentation](https://lodash.com/docs#bindAll) or [package source](https://github.com/lodash/lodash/blob/3.1.0-npm-packages/lodash.bindall) for more details. | ||
See the [documentation](https://lodash.com/docs#bindAll) or [package source](https://github.com/lodash/lodash/blob/4.0.0-npm-packages/lodash.bindall) for more details. |
4104
45
19
+ Addedlodash._arrayeach@^3.0.0
+ Addedlodash.bind@^4.0.0
+ Addedlodash.rest@^4.0.0
+ Addedlodash._arrayeach@3.0.0(transitive)
+ Addedlodash._baseflatten@4.2.1(transitive)
+ Addedlodash.bind@4.2.1(transitive)
+ Addedlodash.rest@4.0.5(transitive)
- Removedlodash._createwrapper@^3.0.0
- Removedlodash.functions@^3.0.0
- Removedlodash.restparam@^3.0.0
- Removedlodash._baseflatten@3.1.4(transitive)
- Removedlodash._basefunctions@3.0.0(transitive)
- Removedlodash._createwrapper@3.2.0(transitive)
- Removedlodash._root@3.0.1(transitive)
- Removedlodash.functions@3.0.0(transitive)
- Removedlodash.isarguments@3.1.0(transitive)
- Removedlodash.isarray@3.0.4(transitive)
- Removedlodash.isfunction@3.0.9(transitive)
- Removedlodash.keysin@3.0.8(transitive)
- Removedlodash.restparam@3.6.1(transitive)
Updatedlodash._baseflatten@^4.0.0