lodash
Advanced tools
Comparing version 3.4.0 to 3.5.0
@@ -50,3 +50,6 @@ var baseIndexOf = require('../internal/baseIndexOf'), | ||
return (value === value ? value === other : other !== other) ? index : -1; | ||
if (value === value ? (value === other) : (other !== other)) { | ||
return index; | ||
} | ||
return -1; | ||
} | ||
@@ -53,0 +56,0 @@ return baseIndexOf(array, value, fromIndex || 0); |
@@ -44,3 +44,6 @@ var binaryIndex = require('../internal/binaryIndex'), | ||
var other = array[index]; | ||
return (value === value ? value === other : other !== other) ? index : -1; | ||
if (value === value ? (value === other) : (other !== other)) { | ||
return index; | ||
} | ||
return -1; | ||
} | ||
@@ -47,0 +50,0 @@ if (value !== value) { |
@@ -30,6 +30,11 @@ var LazyWrapper = require('../internal/LazyWrapper'), | ||
* | ||
* In addition to lodash methods, wrappers also have the following `Array` methods: | ||
* `concat`, `join`, `pop`, `push`, `reverse`, `shift`, `slice`, `sort`, `splice`, | ||
* and `unshift` | ||
* In addition to lodash methods, wrappers have `Array` and `String` methods. | ||
* | ||
* The wrapper `Array` methods are: | ||
* `concat`, `join`, `pop`, `push`, `reverse`, `shift`, `slice`, `sort`, | ||
* `splice`, and `unshift` | ||
* | ||
* The wrapper `String` methods are: | ||
* `replace` and `split` | ||
* | ||
* The wrapper methods that support shortcut fusion are: | ||
@@ -36,0 +41,0 @@ * `compact`, `drop`, `dropRight`, `dropRightWhile`, `dropWhile`, `filter`, |
@@ -17,2 +17,3 @@ var baseSortByOrder = require('../internal/baseSortByOrder'), | ||
* @param {boolean[]} orders The sort orders of `props`. | ||
* @param- {Object} [guard] Enables use as a callback for functions like `_.reduce`. | ||
* @returns {Array} Returns the new sorted array. | ||
@@ -22,5 +23,5 @@ * @example | ||
* var users = [ | ||
* { 'user': 'barney', 'age': 26 }, | ||
* { 'user': 'fred', 'age': 40 }, | ||
* { 'user': 'barney', 'age': 36 }, | ||
* { 'user': 'fred', 'age': 40 }, | ||
* { 'user': 'barney', 'age': 26 }, | ||
* { 'user': 'fred', 'age': 30 } | ||
@@ -27,0 +28,0 @@ * ]; |
@@ -27,3 +27,3 @@ var baseCopy = require('./baseCopy'), | ||
if ((result === result ? result !== value : value === value) || | ||
if ((result === result ? (result !== value) : (value === value)) || | ||
(typeof value == 'undefined' && !(key in object))) { | ||
@@ -30,0 +30,0 @@ object[key] = result; |
@@ -22,3 +22,3 @@ /** | ||
} | ||
length = start > end ? 0 : end >>> 0; | ||
length = start > end ? 0 : (end >>> 0); | ||
start >>>= 0; | ||
@@ -25,0 +25,0 @@ |
@@ -41,3 +41,3 @@ var arrayEach = require('./arrayEach'), | ||
if ((isSrcArr || typeof result != 'undefined') && | ||
(isCommon || (result === result ? result !== value : value === value))) { | ||
(isCommon || (result === result ? (result !== value) : (value === value)))) { | ||
object[key] = result; | ||
@@ -44,0 +44,0 @@ } |
@@ -62,3 +62,3 @@ var arrayCopy = require('./arrayCopy'), | ||
object[key] = mergeFunc(result, srcValue, customizer, stackA, stackB); | ||
} else if (result === result ? result !== value : value === value) { | ||
} else if (result === result ? (result !== value) : (value === value)) { | ||
object[key] = result; | ||
@@ -65,0 +65,0 @@ } |
@@ -22,3 +22,3 @@ /** | ||
} | ||
length = start > end ? 0 : (end - start) >>> 0; | ||
length = start > end ? 0 : ((end - start) >>> 0); | ||
start >>>= 0; | ||
@@ -25,0 +25,0 @@ |
@@ -29,5 +29,4 @@ var baseCompareAscending = require('./baseCompareAscending'); | ||
return result; | ||
} else { | ||
return orders[index] ? result : result * -1; | ||
} | ||
return result * (orders[index] ? 1 : -1); | ||
} | ||
@@ -34,0 +33,0 @@ } |
@@ -16,3 +16,4 @@ var createCtorWrapper = require('./createCtorWrapper'); | ||
function wrapper() { | ||
return (this instanceof wrapper ? Ctor : func).apply(thisArg, arguments); | ||
var fn = (this && this !== global && this instanceof wrapper) ? Ctor : func; | ||
return fn.apply(thisArg, arguments); | ||
} | ||
@@ -19,0 +20,0 @@ return wrapper; |
@@ -15,3 +15,3 @@ /** Used as the `TypeError` message for "Functions" methods. */ | ||
index = length, | ||
fromIndex = fromRight ? length - 1 : 0; | ||
fromIndex = fromRight ? (length - 1) : 0; | ||
@@ -18,0 +18,0 @@ if (!length) { |
@@ -99,3 +99,4 @@ var arrayCopy = require('./arrayCopy'), | ||
} | ||
return (this instanceof wrapper ? (Ctor || createCtorWrapper(func)) : func).apply(thisBinding, args); | ||
var fn = (this && this !== global && this instanceof wrapper) ? (Ctor || createCtorWrapper(func)) : func; | ||
return fn.apply(thisBinding, args); | ||
} | ||
@@ -102,0 +103,0 @@ return wrapper; |
@@ -37,3 +37,4 @@ var createCtorWrapper = require('./createCtorWrapper'); | ||
} | ||
return (this instanceof wrapper ? Ctor : func).apply(isBind ? thisArg : this, args); | ||
var fn = (this && this !== global && this instanceof wrapper) ? Ctor : func; | ||
return fn.apply(isBind ? thisArg : this, args); | ||
} | ||
@@ -40,0 +41,0 @@ return wrapper; |
@@ -64,4 +64,6 @@ var keys = require('../object/keys'); | ||
// Non `Object` object instances with different constructors are not equal. | ||
if (objCtor != othCtor && ('constructor' in object && 'constructor' in other) && | ||
!(typeof objCtor == 'function' && objCtor instanceof objCtor && typeof othCtor == 'function' && othCtor instanceof othCtor)) { | ||
if (objCtor != othCtor && | ||
('constructor' in object && 'constructor' in other) && | ||
!(typeof objCtor == 'function' && objCtor instanceof objCtor && | ||
typeof othCtor == 'function' && othCtor instanceof othCtor)) { | ||
return false; | ||
@@ -68,0 +70,0 @@ } |
@@ -26,3 +26,4 @@ var baseEach = require('./baseEach'); | ||
var current = iteratee(value, index, collection); | ||
if ((isMin ? current < computed : current > computed) || (current === exValue && current === result)) { | ||
if ((isMin ? (current < computed) : (current > computed)) || | ||
(current === exValue && current === result)) { | ||
computed = current; | ||
@@ -29,0 +30,0 @@ result = value; |
@@ -27,3 +27,3 @@ var isIndex = require('./isIndex'), | ||
var other = object[index]; | ||
return value === value ? value === other : other !== other; | ||
return value === value ? (value === other) : (other !== other); | ||
} | ||
@@ -30,0 +30,0 @@ return false; |
@@ -20,3 +20,2 @@ var LazyWrapper = require('./LazyWrapper'), | ||
result.__dir__ = this.__dir__; | ||
result.__dropCount__ = this.__dropCount__; | ||
result.__filtered__ = this.__filtered__; | ||
@@ -23,0 +22,0 @@ result.__iteratees__ = iteratees ? arrayCopy(iteratees) : null; |
@@ -7,4 +7,4 @@ var baseWrapperValue = require('./baseWrapperValue'), | ||
var LAZY_DROP_WHILE_FLAG = 0, | ||
LAZY_MAP_FLAG = 2, | ||
LAZY_TAKE_WHILE_FLAG = 3; | ||
LAZY_FILTER_FLAG = 1, | ||
LAZY_MAP_FLAG = 2; | ||
@@ -33,5 +33,4 @@ /* Native method references for those with the same name as other `lodash` methods. */ | ||
length = end - start, | ||
dropCount = this.__dropCount__, | ||
index = isRight ? end : (start - 1), | ||
takeCount = nativeMin(length, this.__takeCount__), | ||
index = isRight ? end : start - 1, | ||
iteratees = this.__iteratees__, | ||
@@ -54,24 +53,28 @@ iterLength = iteratees ? iteratees.length : 0, | ||
if (type != LAZY_DROP_WHILE_FLAG) { | ||
var computed = iteratee(value); | ||
} else { | ||
data.done = data.done && (isRight ? index < data.index : index > data.index); | ||
if (type == LAZY_DROP_WHILE_FLAG) { | ||
if (data.done && (isRight ? (index > data.index) : (index < data.index))) { | ||
data.count = 0; | ||
data.done = false; | ||
} | ||
data.index = index; | ||
computed = data.done || (data.done = !iteratee(value)); | ||
} | ||
if (type == LAZY_MAP_FLAG) { | ||
value = computed; | ||
} else if (!computed) { | ||
if (type == LAZY_TAKE_WHILE_FLAG) { | ||
break outer; | ||
} else { | ||
continue outer; | ||
if (!data.done) { | ||
var limit = data.limit; | ||
if (!(data.done = limit > -1 ? (data.count++ >= limit) : !iteratee(value))) { | ||
continue outer; | ||
} | ||
} | ||
} else { | ||
var computed = iteratee(value); | ||
if (type == LAZY_MAP_FLAG) { | ||
value = computed; | ||
} else if (!computed) { | ||
if (type == LAZY_FILTER_FLAG) { | ||
continue outer; | ||
} else { | ||
break outer; | ||
} | ||
} | ||
} | ||
} | ||
if (dropCount) { | ||
dropCount--; | ||
} else { | ||
result[resIndex++] = value; | ||
} | ||
result[resIndex++] = value; | ||
} | ||
@@ -78,0 +81,0 @@ return result; |
@@ -33,3 +33,3 @@ var isObjectLike = require('../internal/isObjectLike'), | ||
return (value && value.nodeType === 1 && isObjectLike(value) && | ||
objToString.call(value).indexOf('Element') > -1) || false; | ||
(objToString.call(value).indexOf('Element') > -1)) || false; | ||
} | ||
@@ -36,0 +36,0 @@ // Fallback for environments without DOM support. |
@@ -42,3 +42,3 @@ var isLength = require('../internal/isLength'), | ||
if ((typeof Ctor == 'function' && Ctor.prototype === object) || | ||
(typeof object != 'function' && (length && isLength(length)))) { | ||
(typeof object != 'function' && (length && isLength(length)))) { | ||
return shimKeys(object); | ||
@@ -45,0 +45,0 @@ } |
{ | ||
"name": "lodash", | ||
"version": "3.4.0", | ||
"version": "3.5.0", | ||
"description": "The modern build of lodash modular utilities.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://lodash.com/", |
@@ -1,2 +0,2 @@ | ||
# lodash v3.4.0 | ||
# lodash v3.5.0 | ||
@@ -31,3 +31,3 @@ The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash](https://lodash.com/) exported as [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) modules. | ||
See the [package source](https://github.com/lodash/lodash/tree/3.4.0-npm) for more details. | ||
See the [package source](https://github.com/lodash/lodash/tree/3.5.0-npm) for more details. | ||
@@ -43,4 +43,4 @@ **Note:**<br> | ||
* npm packages for [modern](https://www.npmjs.com/package/lodash), [compatibility](https://www.npmjs.com/package/lodash-compat), & [per method](https://www.npmjs.com/browse/keyword/lodash-modularized) builds | ||
* AMD modules for [modern](https://github.com/lodash/lodash/tree/3.4.0-amd) & [compatibility](https://github.com/lodash/lodash-compat/tree/3.4.0-amd) builds | ||
* ES modules for the [modern](https://github.com/lodash/lodash/tree/3.4.0-es) build | ||
* AMD modules for [modern](https://github.com/lodash/lodash/tree/3.5.0-amd) & [compatibility](https://github.com/lodash/lodash-compat/tree/3.5.0-amd) builds | ||
* ES modules for the [modern](https://github.com/lodash/lodash/tree/3.5.0-es) build | ||
@@ -92,3 +92,3 @@ ## Further Reading | ||
* [_.slice](https://lodash.com/docs#slice) for creating subsets of array-like values | ||
* [_.sortByAll](https://lodash.com/docs#sortBy) & [_.sortByOrder](https://lodash.com/docs#sortByOrder) for sorting by multiple properties & orders | ||
* [_.sortByAll](https://lodash.com/docs#sortByAll) & [_.sortByOrder](https://lodash.com/docs#sortByOrder) for sorting by multiple properties & orders | ||
* [_.spread](https://lodash.com/docs#spread) for creating a function to spread an array of arguments to another | ||
@@ -118,3 +118,3 @@ * [_.sum](https://lodash.com/docs#sum) to get the sum of values | ||
Tested in Chrome 40-41, Firefox 35-36, IE 6-11, Opera 26-27, Safari 5-8, io.js 1.4.3, Node.js 0.8.28, 0.10.36, & 0.12.0, PhantomJS 1.9.8, RingoJS 0.11, & Rhino 1.7RC5. | ||
Tested in Chrome 40-41, Firefox 35-36, IE 6-11, Opera 26-27, Safari 5-8, io.js 1.5.0, Node.js 0.8.28, 0.10.36, & 0.12.0, PhantomJS 1.9.8, RingoJS 0.11, & Rhino 1.7RC5. | ||
Automated [browser](https://saucelabs.com/u/lodash) & [CI](https://travis-ci.org/lodash/lodash/) test runs are available. Special thanks to [Sauce Labs](https://saucelabs.com/) for providing automated browser testing. |
@@ -32,3 +32,7 @@ var baseToString = require('../internal/baseToString'); | ||
var length = string.length; | ||
position = (typeof position == 'undefined' ? length : nativeMin(position < 0 ? 0 : (+position || 0), length)) - target.length; | ||
position = typeof position == 'undefined' | ||
? length | ||
: nativeMin(position < 0 ? 0 : (+position || 0), length); | ||
position -= target.length; | ||
return position >= 0 && string.indexOf(target, position) == position; | ||
@@ -35,0 +39,0 @@ } |
@@ -29,3 +29,6 @@ var baseToString = require('../internal/baseToString'); | ||
string = baseToString(string); | ||
position = position == null ? 0 : nativeMin(position < 0 ? 0 : (+position || 0), string.length); | ||
position = position == null | ||
? 0 | ||
: nativeMin(position < 0 ? 0 : (+position || 0), string.length); | ||
return string.lastIndexOf(target, position) == position; | ||
@@ -32,0 +35,0 @@ } |
@@ -63,3 +63,3 @@ var baseToString = require('../internal/baseToString'), | ||
var separator = 'separator' in options ? options.separator : separator; | ||
length = 'length' in options ? +options.length || 0 : length; | ||
length = 'length' in options ? (+options.length || 0) : length; | ||
omission = 'omission' in options ? baseToString(options.omission) : omission; | ||
@@ -66,0 +66,0 @@ } else { |
@@ -26,3 +26,3 @@ var isError = require('../lang/isError'); | ||
length = arguments.length, | ||
args = Array(length ? length - 1 : 0); | ||
args = Array(length ? (length - 1) : 0); | ||
@@ -29,0 +29,0 @@ while (--length > 0) { |
@@ -73,3 +73,7 @@ var arrayCopy = require('../internal/arrayCopy'), | ||
var result = object(this.__wrapped__); | ||
(result.__actions__ = arrayCopy(this.__actions__)).push({ 'func': func, 'args': arguments, 'thisArg': object }); | ||
(result.__actions__ = arrayCopy(this.__actions__)).push({ | ||
'func': func, | ||
'args': arguments, | ||
'thisArg': object | ||
}); | ||
result.__chain__ = chainAll; | ||
@@ -76,0 +80,0 @@ return result; |
Sorry, the diff of this file is too big to display
791358
22831