lodash._basefor
Advanced tools
Comparing version 3.0.0 to 3.0.1
43
index.js
/** | ||
* lodash 3.0.0 (Custom Build) <https://lodash.com/> | ||
* lodash 3.0.1 (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.7.0 <http://underscorejs.org/LICENSE> | ||
* Based on Underscore.js 1.8.2 <http://underscorejs.org/LICENSE> | ||
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors | ||
@@ -22,15 +22,26 @@ * Available under MIT license <https://lodash.com/license> | ||
*/ | ||
function baseFor(object, iteratee, keysFunc) { | ||
var index = -1, | ||
iterable = toObject(object), | ||
props = keysFunc(object), | ||
length = props.length; | ||
var baseFor = createBaseFor(); | ||
while (++index < length) { | ||
var key = props[index]; | ||
if (iteratee(iterable[key], key, iterable) === false) { | ||
break; | ||
/** | ||
* Creates a base function for `_.forIn` or `_.forInRight`. | ||
* | ||
* @private | ||
* @param {boolean} [fromRight] Specify iterating from right to left. | ||
* @returns {Function} Returns the new base function. | ||
*/ | ||
function createBaseFor(fromRight) { | ||
return function(object, iteratee, keysFunc) { | ||
var iterable = toObject(object), | ||
props = keysFunc(object), | ||
length = props.length, | ||
index = fromRight ? length : -1; | ||
while ((fromRight ? index-- : ++index < length)) { | ||
var key = props[index]; | ||
if (iteratee(iterable[key], key, iterable) === false) { | ||
break; | ||
} | ||
} | ||
} | ||
return object; | ||
return object; | ||
}; | ||
} | ||
@@ -50,7 +61,5 @@ | ||
/** | ||
* Checks if `value` is the language type of `Object`. | ||
* Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. | ||
* (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) | ||
* | ||
* **Note:** See the [ES5 spec](https://es5.github.io/#x8) for more details. | ||
* | ||
* @static | ||
@@ -76,5 +85,5 @@ * @memberOf _ | ||
var type = typeof value; | ||
return type == 'function' || (value && type == 'object') || false; | ||
return type == 'function' || (!!value && type == 'object'); | ||
} | ||
module.exports = baseFor; |
Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> | ||
Based on Underscore.js 1.7.0, copyright 2009-2015 Jeremy Ashkenas, | ||
Based on Underscore.js, copyright 2009-2015 Jeremy Ashkenas, | ||
DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/> | ||
@@ -4,0 +4,0 @@ |
{ | ||
"name": "lodash._basefor", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "The modern build of lodash’s internal `baseFor` as a module.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://lodash.com/", |
@@ -1,2 +0,2 @@ | ||
# lodash._basefor v3.0.0 | ||
# lodash._basefor v3.0.1 | ||
@@ -20,2 +20,2 @@ The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) internal `baseFor` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. | ||
See the [package source](https://github.com/lodash/lodash/blob/3.0.0-npm-packages/lodash._basefor) for more details. | ||
See the [package source](https://github.com/lodash/lodash/blob/3.0.1-npm-packages/lodash._basefor) for more details. |
5150
80