lodash.forin
Advanced tools
+22
| Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/> | ||
| Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, | ||
| DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/> | ||
| Permission is hereby granted, free of charge, to any person obtaining | ||
| a copy of this software and associated documentation files (the | ||
| "Software"), to deal in the Software without restriction, including | ||
| without limitation the rights to use, copy, modify, merge, publish, | ||
| distribute, sublicense, and/or sell copies of the Software, and to | ||
| permit persons to whom the Software is furnished to do so, subject to | ||
| the following conditions: | ||
| The above copyright notice and this permission notice shall be | ||
| included in all copies or substantial portions of the Software. | ||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
| NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
| LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
| OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
| WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
+35
-21
| /** | ||
| * lodash 3.0.2 (Custom Build) <https://lodash.com/> | ||
| * Build: `lodash modern modularize exports="npm" -o ./` | ||
| * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> | ||
| * 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-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors | ||
| * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors | ||
| * Available under MIT license <https://lodash.com/license> | ||
| */ | ||
| var baseFor = require('lodash._basefor'), | ||
| bindCallback = require('lodash._bindcallback'), | ||
| keysIn = require('lodash.keysin'); | ||
| /** | ||
| * Creates a function for `_.forIn` or `_.forInRight`. | ||
| * Converts `value` to a function if it's not one. | ||
| * | ||
| * @private | ||
| * @param {Function} objectFunc The function to iterate over an object. | ||
| * @returns {Function} Returns the new each function. | ||
| * @param {*} value The value to process. | ||
| * @returns {Function} Returns the function. | ||
| */ | ||
| function createForIn(objectFunc) { | ||
| return function(object, iteratee, thisArg) { | ||
| if (typeof iteratee != 'function' || thisArg !== undefined) { | ||
| iteratee = bindCallback(iteratee, thisArg, 3); | ||
| } | ||
| return objectFunc(object, iteratee, keysIn); | ||
| }; | ||
| function toFunction(value) { | ||
| return typeof value == 'function' ? value : identity; | ||
| } | ||
@@ -31,5 +25,5 @@ | ||
| * Iterates over own and inherited enumerable properties of an object invoking | ||
| * `iteratee` for each property. The `iteratee` is bound to `thisArg` and invoked | ||
| * with three arguments: (value, key, object). Iteratee functions may exit | ||
| * iteration early by explicitly returning `false`. | ||
| * `iteratee` for each property. The iteratee is invoked with three arguments: | ||
| * (value, key, object). Iteratee functions may exit iteration early by explicitly | ||
| * returning `false`. | ||
| * | ||
@@ -41,3 +35,2 @@ * @static | ||
| * @param {Function} [iteratee=_.identity] The function invoked per iteration. | ||
| * @param {*} [thisArg] The `this` binding of `iteratee`. | ||
| * @returns {Object} Returns `object`. | ||
@@ -56,6 +49,27 @@ * @example | ||
| * }); | ||
| * // => logs 'a', 'b', and 'c' (iteration order is not guaranteed) | ||
| * // => logs 'a', 'b', then 'c' (iteration order is not guaranteed) | ||
| */ | ||
| var forIn = createForIn(baseFor); | ||
| function forIn(object, iteratee) { | ||
| return object == null ? object : baseFor(object, toFunction(iteratee), keysIn); | ||
| } | ||
| /** | ||
| * This method returns the first argument provided to it. | ||
| * | ||
| * @static | ||
| * @memberOf _ | ||
| * @category Util | ||
| * @param {*} value Any value. | ||
| * @returns {*} Returns `value`. | ||
| * @example | ||
| * | ||
| * var object = { 'user': 'fred' }; | ||
| * | ||
| * _.identity(object) === object; | ||
| * // => true | ||
| */ | ||
| function identity(value) { | ||
| return value; | ||
| } | ||
| module.exports = forIn; |
+5
-8
| { | ||
| "name": "lodash.forin", | ||
| "version": "3.0.2", | ||
| "description": "The modern build of lodash’s `_.forIn` as a module.", | ||
| "version": "4.0.0", | ||
| "description": "The lodash method `_.forIn` 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, forin", | ||
| "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/)" | ||
@@ -21,5 +19,4 @@ ], | ||
| "lodash._basefor": "^3.0.0", | ||
| "lodash._bindcallback": "^3.0.0", | ||
| "lodash.keysin": "^3.0.0" | ||
| "lodash.keysin": "^4.0.0" | ||
| } | ||
| } |
+4
-6
@@ -1,4 +0,4 @@ | ||
| # lodash.forin v3.0.2 | ||
| # lodash.forin v4.0.0 | ||
| The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.forIn` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. | ||
| The [lodash](https://lodash.com/) method `_.forIn` 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 forIn = require('lodash.forin'); | ||
| See the [documentation](https://lodash.com/docs#forIn) or [package source](https://github.com/lodash/lodash/blob/3.0.2-npm-packages/lodash.forin) for more details. | ||
| See the [documentation](https://lodash.com/docs#forIn) or [package source](https://github.com/lodash/lodash/blob/4.0.0-npm-packages/lodash.forin) for more details. |
-22
| Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> | ||
| Based on Underscore.js, copyright 2009-2015 Jeremy Ashkenas, | ||
| DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/> | ||
| Permission is hereby granted, free of charge, to any person obtaining | ||
| a copy of this software and associated documentation files (the | ||
| "Software"), to deal in the Software without restriction, including | ||
| without limitation the rights to use, copy, modify, merge, publish, | ||
| distribute, sublicense, and/or sell copies of the Software, and to | ||
| permit persons to whom the Software is furnished to do so, subject to | ||
| the following conditions: | ||
| The above copyright notice and this permission notice shall be | ||
| included in all copies or substantial portions of the Software. | ||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
| NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
| LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
| OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
| WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
2
-33.33%68
23.64%4462
-4.86%19
-9.52%+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
Updated