mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-03 00:27:50 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
707fe171fc |
@@ -1,4 +1,4 @@
|
|||||||
# lodash v3.4.0
|
# lodash v3.5.0
|
||||||
|
|
||||||
The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash](https://lodash.com/) exported as [AMD](https://github.com/amdjs/amdjs-api/wiki/AMD) modules.
|
The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash](https://lodash.com/) exported as [AMD](https://github.com/amdjs/amdjs-api/wiki/AMD) modules.
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,10 @@ define(['../internal/baseIndexOf', '../internal/binaryIndex'], function(baseInde
|
|||||||
var index = binaryIndex(array, value),
|
var index = binaryIndex(array, value),
|
||||||
other = array[index];
|
other = array[index];
|
||||||
|
|
||||||
return (value === value ? value === other : other !== other) ? index : -1;
|
if (value === value ? (value === other) : (other !== other)) {
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
return baseIndexOf(array, value, fromIndex || 0);
|
return baseIndexOf(array, value, fromIndex || 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,10 @@ define(['../internal/binaryIndex', '../internal/indexOfNaN'], function(binaryInd
|
|||||||
} else if (fromIndex) {
|
} else if (fromIndex) {
|
||||||
index = binaryIndex(array, value, true) - 1;
|
index = binaryIndex(array, value, true) - 1;
|
||||||
var other = array[index];
|
var other = array[index];
|
||||||
return (value === value ? value === other : other !== other) ? index : -1;
|
if (value === value ? (value === other) : (other !== other)) {
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
if (value !== value) {
|
if (value !== value) {
|
||||||
return indexOfNaN(array, index, true);
|
return indexOfNaN(array, index, true);
|
||||||
|
|||||||
@@ -22,9 +22,14 @@ define(['../internal/LazyWrapper', '../internal/LodashWrapper', '../internal/bas
|
|||||||
* Chaining is supported in custom builds as long as the `_#value` method is
|
* Chaining is supported in custom builds as long as the `_#value` method is
|
||||||
* directly or indirectly included in the build.
|
* directly or indirectly included in the build.
|
||||||
*
|
*
|
||||||
* In addition to lodash methods, wrappers also have the following `Array` methods:
|
* In addition to lodash methods, wrappers have `Array` and `String` methods.
|
||||||
* `concat`, `join`, `pop`, `push`, `reverse`, `shift`, `slice`, `sort`, `splice`,
|
*
|
||||||
* and `unshift`
|
* 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:
|
* The wrapper methods that support shortcut fusion are:
|
||||||
* `compact`, `drop`, `dropRight`, `dropRightWhile`, `dropWhile`, `filter`,
|
* `compact`, `drop`, `dropRight`, `dropRightWhile`, `dropWhile`, `filter`,
|
||||||
|
|||||||
@@ -12,13 +12,14 @@ define(['../internal/baseSortByOrder', '../lang/isArray', '../internal/isIterate
|
|||||||
* @param {Array|Object|string} collection The collection to iterate over.
|
* @param {Array|Object|string} collection The collection to iterate over.
|
||||||
* @param {string[]} props The property names to sort by.
|
* @param {string[]} props The property names to sort by.
|
||||||
* @param {boolean[]} orders The sort orders of `props`.
|
* @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.
|
* @returns {Array} Returns the new sorted array.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var users = [
|
* var users = [
|
||||||
* { 'user': 'barney', 'age': 36 },
|
|
||||||
* { 'user': 'fred', 'age': 40 },
|
|
||||||
* { 'user': 'barney', 'age': 26 },
|
* { 'user': 'barney', 'age': 26 },
|
||||||
|
* { 'user': 'fred', 'age': 40 },
|
||||||
|
* { 'user': 'barney', 'age': 36 },
|
||||||
* { 'user': 'fred', 'age': 30 }
|
* { 'user': 'fred', 'age': 30 }
|
||||||
* ];
|
* ];
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ define(['./baseCopy', '../object/keys'], function(baseCopy, keys) {
|
|||||||
value = object[key],
|
value = object[key],
|
||||||
result = customizer(value, source[key], key, object, source);
|
result = customizer(value, source[key], key, object, source);
|
||||||
|
|
||||||
if ((result === result ? result !== value : value === value) ||
|
if ((result === result ? (result !== value) : (value === value)) ||
|
||||||
(typeof value == 'undefined' && !(key in object))) {
|
(typeof value == 'undefined' && !(key in object))) {
|
||||||
object[key] = result;
|
object[key] = result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ define([], function() {
|
|||||||
if (end < 0) {
|
if (end < 0) {
|
||||||
end += length;
|
end += length;
|
||||||
}
|
}
|
||||||
length = start > end ? 0 : end >>> 0;
|
length = start > end ? 0 : (end >>> 0);
|
||||||
start >>>= 0;
|
start >>>= 0;
|
||||||
|
|
||||||
while (start < length) {
|
while (start < length) {
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ define(['./arrayEach', './baseForOwn', './baseMergeDeep', '../lang/isArray', './
|
|||||||
result = srcValue;
|
result = srcValue;
|
||||||
}
|
}
|
||||||
if ((isSrcArr || typeof result != 'undefined') &&
|
if ((isSrcArr || typeof result != 'undefined') &&
|
||||||
(isCommon || (result === result ? result !== value : value === value))) {
|
(isCommon || (result === result ? (result !== value) : (value === value)))) {
|
||||||
object[key] = result;
|
object[key] = result;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ define(['./arrayCopy', '../lang/isArguments', '../lang/isArray', './isLength', '
|
|||||||
if (isCommon) {
|
if (isCommon) {
|
||||||
// Recursively merge objects and arrays (susceptible to call stack limits).
|
// Recursively merge objects and arrays (susceptible to call stack limits).
|
||||||
object[key] = mergeFunc(result, srcValue, customizer, stackA, stackB);
|
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;
|
object[key] = result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ define([], function() {
|
|||||||
if (end < 0) {
|
if (end < 0) {
|
||||||
end += length;
|
end += length;
|
||||||
}
|
}
|
||||||
length = start > end ? 0 : (end - start) >>> 0;
|
length = start > end ? 0 : ((end - start) >>> 0);
|
||||||
start >>>= 0;
|
start >>>= 0;
|
||||||
|
|
||||||
var result = Array(length);
|
var result = Array(length);
|
||||||
|
|||||||
@@ -26,9 +26,8 @@ define(['./baseCompareAscending'], function(baseCompareAscending) {
|
|||||||
if (result) {
|
if (result) {
|
||||||
if (index >= ordersLength) {
|
if (index >= ordersLength) {
|
||||||
return result;
|
return result;
|
||||||
} else {
|
|
||||||
return orders[index] ? result : result * -1;
|
|
||||||
}
|
}
|
||||||
|
return result * (orders[index] ? 1 : -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
|
// Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
define(['./createCtorWrapper'], function(createCtorWrapper) {
|
define(['./createCtorWrapper', './root'], function(createCtorWrapper, root) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a function that wraps `func` and invokes it with the `this`
|
* Creates a function that wraps `func` and invokes it with the `this`
|
||||||
@@ -13,7 +13,8 @@ define(['./createCtorWrapper'], function(createCtorWrapper) {
|
|||||||
var Ctor = createCtorWrapper(func);
|
var Ctor = createCtorWrapper(func);
|
||||||
|
|
||||||
function wrapper() {
|
function wrapper() {
|
||||||
return (this instanceof wrapper ? Ctor : func).apply(thisArg, arguments);
|
var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
|
||||||
|
return fn.apply(thisArg, arguments);
|
||||||
}
|
}
|
||||||
return wrapper;
|
return wrapper;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ define([], function() {
|
|||||||
return function() {
|
return function() {
|
||||||
var length = arguments.length,
|
var length = arguments.length,
|
||||||
index = length,
|
index = length,
|
||||||
fromIndex = fromRight ? length - 1 : 0;
|
fromIndex = fromRight ? (length - 1) : 0;
|
||||||
|
|
||||||
if (!length) {
|
if (!length) {
|
||||||
return function() { return arguments[0]; };
|
return function() { return arguments[0]; };
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
define(['./arrayCopy', './composeArgs', './composeArgsRight', './createCtorWrapper', './reorder', './replaceHolders'], function(arrayCopy, composeArgs, composeArgsRight, createCtorWrapper, reorder, replaceHolders) {
|
define(['./arrayCopy', './composeArgs', './composeArgsRight', './createCtorWrapper', './reorder', './replaceHolders', './root'], function(arrayCopy, composeArgs, composeArgsRight, createCtorWrapper, reorder, replaceHolders, root) {
|
||||||
|
|
||||||
/** Used to compose bitmasks for wrapper metadata. */
|
/** Used to compose bitmasks for wrapper metadata. */
|
||||||
var BIND_FLAG = 1,
|
var BIND_FLAG = 1,
|
||||||
@@ -91,7 +91,8 @@ define(['./arrayCopy', './composeArgs', './composeArgsRight', './createCtorWrapp
|
|||||||
if (isAry && ary < args.length) {
|
if (isAry && ary < args.length) {
|
||||||
args.length = ary;
|
args.length = ary;
|
||||||
}
|
}
|
||||||
return (this instanceof wrapper ? (Ctor || createCtorWrapper(func)) : func).apply(thisBinding, args);
|
var fn = (this && this !== root && this instanceof wrapper) ? (Ctor || createCtorWrapper(func)) : func;
|
||||||
|
return fn.apply(thisBinding, args);
|
||||||
}
|
}
|
||||||
return wrapper;
|
return wrapper;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
define(['./createCtorWrapper'], function(createCtorWrapper) {
|
define(['./createCtorWrapper', './root'], function(createCtorWrapper, root) {
|
||||||
|
|
||||||
/** Used to compose bitmasks for wrapper metadata. */
|
/** Used to compose bitmasks for wrapper metadata. */
|
||||||
var BIND_FLAG = 1;
|
var BIND_FLAG = 1;
|
||||||
@@ -34,7 +34,8 @@ define(['./createCtorWrapper'], function(createCtorWrapper) {
|
|||||||
while (argsLength--) {
|
while (argsLength--) {
|
||||||
args[leftIndex++] = arguments[++argsIndex];
|
args[leftIndex++] = arguments[++argsIndex];
|
||||||
}
|
}
|
||||||
return (this instanceof wrapper ? Ctor : func).apply(isBind ? thisArg : this, args);
|
var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
|
||||||
|
return fn.apply(isBind ? thisArg : this, args);
|
||||||
}
|
}
|
||||||
return wrapper;
|
return wrapper;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,8 +64,10 @@ define(['../object/keys'], function(keys) {
|
|||||||
othCtor = other.constructor;
|
othCtor = other.constructor;
|
||||||
|
|
||||||
// Non `Object` object instances with different constructors are not equal.
|
// Non `Object` object instances with different constructors are not equal.
|
||||||
if (objCtor != othCtor && ('constructor' in object && 'constructor' in other) &&
|
if (objCtor != othCtor &&
|
||||||
!(typeof objCtor == 'function' && objCtor instanceof objCtor && typeof othCtor == 'function' && othCtor instanceof othCtor)) {
|
('constructor' in object && 'constructor' in other) &&
|
||||||
|
!(typeof objCtor == 'function' && objCtor instanceof objCtor &&
|
||||||
|
typeof othCtor == 'function' && othCtor instanceof othCtor)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,8 @@ define(['./baseEach'], function(baseEach) {
|
|||||||
|
|
||||||
baseEach(collection, function(value, index, collection) {
|
baseEach(collection, function(value, index, collection) {
|
||||||
var current = iteratee(value, index, collection);
|
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;
|
computed = current;
|
||||||
result = value;
|
result = value;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ define(['./isIndex', './isLength', '../lang/isObject'], function(isIndex, isLeng
|
|||||||
}
|
}
|
||||||
if (prereq) {
|
if (prereq) {
|
||||||
var other = object[index];
|
var other = object[index];
|
||||||
return value === value ? value === other : other !== other;
|
return value === value ? (value === other) : (other !== other);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ define(['./LazyWrapper', './arrayCopy'], function(LazyWrapper, arrayCopy) {
|
|||||||
|
|
||||||
result.__actions__ = actions ? arrayCopy(actions) : null;
|
result.__actions__ = actions ? arrayCopy(actions) : null;
|
||||||
result.__dir__ = this.__dir__;
|
result.__dir__ = this.__dir__;
|
||||||
result.__dropCount__ = this.__dropCount__;
|
|
||||||
result.__filtered__ = this.__filtered__;
|
result.__filtered__ = this.__filtered__;
|
||||||
result.__iteratees__ = iteratees ? arrayCopy(iteratees) : null;
|
result.__iteratees__ = iteratees ? arrayCopy(iteratees) : null;
|
||||||
result.__takeCount__ = this.__takeCount__;
|
result.__takeCount__ = this.__takeCount__;
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ define(['./baseWrapperValue', './getView', '../lang/isArray'], function(baseWrap
|
|||||||
|
|
||||||
/** Used to indicate the type of lazy iteratees. */
|
/** Used to indicate the type of lazy iteratees. */
|
||||||
var LAZY_DROP_WHILE_FLAG = 0,
|
var LAZY_DROP_WHILE_FLAG = 0,
|
||||||
LAZY_MAP_FLAG = 2,
|
LAZY_FILTER_FLAG = 1,
|
||||||
LAZY_TAKE_WHILE_FLAG = 3;
|
LAZY_MAP_FLAG = 2;
|
||||||
|
|
||||||
/* Native method references for those with the same name as other `lodash` methods. */
|
/* Native method references for those with the same name as other `lodash` methods. */
|
||||||
var nativeMin = Math.min;
|
var nativeMin = Math.min;
|
||||||
@@ -27,9 +27,8 @@ define(['./baseWrapperValue', './getView', '../lang/isArray'], function(baseWrap
|
|||||||
start = view.start,
|
start = view.start,
|
||||||
end = view.end,
|
end = view.end,
|
||||||
length = end - start,
|
length = end - start,
|
||||||
dropCount = this.__dropCount__,
|
index = isRight ? end : (start - 1),
|
||||||
takeCount = nativeMin(length, this.__takeCount__),
|
takeCount = nativeMin(length, this.__takeCount__),
|
||||||
index = isRight ? end : start - 1,
|
|
||||||
iteratees = this.__iteratees__,
|
iteratees = this.__iteratees__,
|
||||||
iterLength = iteratees ? iteratees.length : 0,
|
iterLength = iteratees ? iteratees.length : 0,
|
||||||
resIndex = 0,
|
resIndex = 0,
|
||||||
@@ -47,28 +46,32 @@ define(['./baseWrapperValue', './getView', '../lang/isArray'], function(baseWrap
|
|||||||
iteratee = data.iteratee,
|
iteratee = data.iteratee,
|
||||||
type = data.type;
|
type = data.type;
|
||||||
|
|
||||||
if (type != LAZY_DROP_WHILE_FLAG) {
|
if (type == LAZY_DROP_WHILE_FLAG) {
|
||||||
var computed = iteratee(value);
|
if (data.done && (isRight ? (index > data.index) : (index < data.index))) {
|
||||||
} else {
|
data.count = 0;
|
||||||
data.done = data.done && (isRight ? index < data.index : index > data.index);
|
data.done = false;
|
||||||
|
}
|
||||||
data.index = index;
|
data.index = index;
|
||||||
computed = data.done || (data.done = !iteratee(value));
|
if (!data.done) {
|
||||||
}
|
var limit = data.limit;
|
||||||
if (type == LAZY_MAP_FLAG) {
|
if (!(data.done = limit > -1 ? (data.count++ >= limit) : !iteratee(value))) {
|
||||||
value = computed;
|
continue outer;
|
||||||
} else if (!computed) {
|
}
|
||||||
if (type == LAZY_TAKE_WHILE_FLAG) {
|
}
|
||||||
break outer;
|
} else {
|
||||||
} else {
|
var computed = iteratee(value);
|
||||||
continue outer;
|
if (type == LAZY_MAP_FLAG) {
|
||||||
|
value = computed;
|
||||||
|
} else if (!computed) {
|
||||||
|
if (type == LAZY_FILTER_FLAG) {
|
||||||
|
continue outer;
|
||||||
|
} else {
|
||||||
|
break outer;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (dropCount) {
|
result[resIndex++] = value;
|
||||||
dropCount--;
|
|
||||||
} else {
|
|
||||||
result[resIndex++] = value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ define(['../internal/isObjectLike', './isPlainObject', '../support'], function(i
|
|||||||
*/
|
*/
|
||||||
function isElement(value) {
|
function isElement(value) {
|
||||||
return (value && value.nodeType === 1 && isObjectLike(value) &&
|
return (value && value.nodeType === 1 && isObjectLike(value) &&
|
||||||
objToString.call(value).indexOf('Element') > -1) || false;
|
(objToString.call(value).indexOf('Element') > -1)) || false;
|
||||||
}
|
}
|
||||||
// Fallback for environments without DOM support.
|
// Fallback for environments without DOM support.
|
||||||
if (!support.dom) {
|
if (!support.dom) {
|
||||||
|
|||||||
176
main.js
176
main.js
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* @license
|
* @license
|
||||||
* lodash 3.4.0 (Custom Build) <https://lodash.com/>
|
* lodash 3.5.0 (Custom Build) <https://lodash.com/>
|
||||||
* Build: `lodash modern exports="amd" -d -o ./main.js`
|
* Build: `lodash modern exports="amd" -d -o ./main.js`
|
||||||
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
|
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
|
||||||
* Based on Underscore.js 1.8.2 <http://underscorejs.org/LICENSE>
|
* Based on Underscore.js 1.8.2 <http://underscorejs.org/LICENSE>
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
var undefined;
|
var undefined;
|
||||||
|
|
||||||
/** Used as the semantic version number. */
|
/** Used as the semantic version number. */
|
||||||
var VERSION = '3.4.0';
|
var VERSION = '3.5.0';
|
||||||
|
|
||||||
/** Used to compose bitmasks for wrapper metadata. */
|
/** Used to compose bitmasks for wrapper metadata. */
|
||||||
var BIND_FLAG = 1,
|
var BIND_FLAG = 1,
|
||||||
@@ -36,8 +36,8 @@
|
|||||||
|
|
||||||
/** Used to indicate the type of lazy iteratees. */
|
/** Used to indicate the type of lazy iteratees. */
|
||||||
var LAZY_DROP_WHILE_FLAG = 0,
|
var LAZY_DROP_WHILE_FLAG = 0,
|
||||||
LAZY_MAP_FLAG = 2,
|
LAZY_FILTER_FLAG = 1,
|
||||||
LAZY_TAKE_WHILE_FLAG = 3;
|
LAZY_MAP_FLAG = 2;
|
||||||
|
|
||||||
/** Used as the `TypeError` message for "Functions" methods. */
|
/** Used as the `TypeError` message for "Functions" methods. */
|
||||||
var FUNC_ERROR_TEXT = 'Expected a function';
|
var FUNC_ERROR_TEXT = 'Expected a function';
|
||||||
@@ -435,9 +435,8 @@
|
|||||||
if (result) {
|
if (result) {
|
||||||
if (index >= ordersLength) {
|
if (index >= ordersLength) {
|
||||||
return result;
|
return result;
|
||||||
} else {
|
|
||||||
return orders[index] ? result : result * -1;
|
|
||||||
}
|
}
|
||||||
|
return result * (orders[index] ? 1 : -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
|
// Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
|
||||||
@@ -683,7 +682,8 @@
|
|||||||
|
|
||||||
/** Used for native method references. */
|
/** Used for native method references. */
|
||||||
var arrayProto = Array.prototype,
|
var arrayProto = Array.prototype,
|
||||||
objectProto = Object.prototype;
|
objectProto = Object.prototype,
|
||||||
|
stringProto = String.prototype;
|
||||||
|
|
||||||
/** Used to detect DOM support. */
|
/** Used to detect DOM support. */
|
||||||
var document = (document = context.window) && document.document;
|
var document = (document = context.window) && document.document;
|
||||||
@@ -795,9 +795,14 @@
|
|||||||
* Chaining is supported in custom builds as long as the `_#value` method is
|
* Chaining is supported in custom builds as long as the `_#value` method is
|
||||||
* directly or indirectly included in the build.
|
* directly or indirectly included in the build.
|
||||||
*
|
*
|
||||||
* In addition to lodash methods, wrappers also have the following `Array` methods:
|
* In addition to lodash methods, wrappers have `Array` and `String` methods.
|
||||||
* `concat`, `join`, `pop`, `push`, `reverse`, `shift`, `slice`, `sort`, `splice`,
|
*
|
||||||
* and `unshift`
|
* 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:
|
* The wrapper methods that support shortcut fusion are:
|
||||||
* `compact`, `drop`, `dropRight`, `dropRightWhile`, `dropWhile`, `filter`,
|
* `compact`, `drop`, `dropRight`, `dropRightWhile`, `dropWhile`, `filter`,
|
||||||
@@ -1058,7 +1063,6 @@
|
|||||||
|
|
||||||
result.__actions__ = actions ? arrayCopy(actions) : null;
|
result.__actions__ = actions ? arrayCopy(actions) : null;
|
||||||
result.__dir__ = this.__dir__;
|
result.__dir__ = this.__dir__;
|
||||||
result.__dropCount__ = this.__dropCount__;
|
|
||||||
result.__filtered__ = this.__filtered__;
|
result.__filtered__ = this.__filtered__;
|
||||||
result.__iteratees__ = iteratees ? arrayCopy(iteratees) : null;
|
result.__iteratees__ = iteratees ? arrayCopy(iteratees) : null;
|
||||||
result.__takeCount__ = this.__takeCount__;
|
result.__takeCount__ = this.__takeCount__;
|
||||||
@@ -1105,9 +1109,8 @@
|
|||||||
start = view.start,
|
start = view.start,
|
||||||
end = view.end,
|
end = view.end,
|
||||||
length = end - start,
|
length = end - start,
|
||||||
dropCount = this.__dropCount__,
|
index = isRight ? end : (start - 1),
|
||||||
takeCount = nativeMin(length, this.__takeCount__),
|
takeCount = nativeMin(length, this.__takeCount__),
|
||||||
index = isRight ? end : start - 1,
|
|
||||||
iteratees = this.__iteratees__,
|
iteratees = this.__iteratees__,
|
||||||
iterLength = iteratees ? iteratees.length : 0,
|
iterLength = iteratees ? iteratees.length : 0,
|
||||||
resIndex = 0,
|
resIndex = 0,
|
||||||
@@ -1125,28 +1128,32 @@
|
|||||||
iteratee = data.iteratee,
|
iteratee = data.iteratee,
|
||||||
type = data.type;
|
type = data.type;
|
||||||
|
|
||||||
if (type != LAZY_DROP_WHILE_FLAG) {
|
if (type == LAZY_DROP_WHILE_FLAG) {
|
||||||
var computed = iteratee(value);
|
if (data.done && (isRight ? (index > data.index) : (index < data.index))) {
|
||||||
} else {
|
data.count = 0;
|
||||||
data.done = data.done && (isRight ? index < data.index : index > data.index);
|
data.done = false;
|
||||||
|
}
|
||||||
data.index = index;
|
data.index = index;
|
||||||
computed = data.done || (data.done = !iteratee(value));
|
if (!data.done) {
|
||||||
}
|
var limit = data.limit;
|
||||||
if (type == LAZY_MAP_FLAG) {
|
if (!(data.done = limit > -1 ? (data.count++ >= limit) : !iteratee(value))) {
|
||||||
value = computed;
|
continue outer;
|
||||||
} else if (!computed) {
|
}
|
||||||
if (type == LAZY_TAKE_WHILE_FLAG) {
|
}
|
||||||
break outer;
|
} else {
|
||||||
} else {
|
var computed = iteratee(value);
|
||||||
continue outer;
|
if (type == LAZY_MAP_FLAG) {
|
||||||
|
value = computed;
|
||||||
|
} else if (!computed) {
|
||||||
|
if (type == LAZY_FILTER_FLAG) {
|
||||||
|
continue outer;
|
||||||
|
} else {
|
||||||
|
break outer;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (dropCount) {
|
result[resIndex++] = value;
|
||||||
dropCount--;
|
|
||||||
} else {
|
|
||||||
result[resIndex++] = value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -1566,7 +1573,7 @@
|
|||||||
value = object[key],
|
value = object[key],
|
||||||
result = customizer(value, source[key], key, object, source);
|
result = customizer(value, source[key], key, object, source);
|
||||||
|
|
||||||
if ((result === result ? result !== value : value === value) ||
|
if ((result === result ? (result !== value) : (value === value)) ||
|
||||||
(typeof value == 'undefined' && !(key in object))) {
|
(typeof value == 'undefined' && !(key in object))) {
|
||||||
object[key] = result;
|
object[key] = result;
|
||||||
}
|
}
|
||||||
@@ -1913,7 +1920,7 @@
|
|||||||
if (end < 0) {
|
if (end < 0) {
|
||||||
end += length;
|
end += length;
|
||||||
}
|
}
|
||||||
length = start > end ? 0 : end >>> 0;
|
length = start > end ? 0 : (end >>> 0);
|
||||||
start >>>= 0;
|
start >>>= 0;
|
||||||
|
|
||||||
while (start < length) {
|
while (start < length) {
|
||||||
@@ -2400,7 +2407,7 @@
|
|||||||
result = srcValue;
|
result = srcValue;
|
||||||
}
|
}
|
||||||
if ((isSrcArr || typeof result != 'undefined') &&
|
if ((isSrcArr || typeof result != 'undefined') &&
|
||||||
(isCommon || (result === result ? result !== value : value === value))) {
|
(isCommon || (result === result ? (result !== value) : (value === value)))) {
|
||||||
object[key] = result;
|
object[key] = result;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -2460,7 +2467,7 @@
|
|||||||
if (isCommon) {
|
if (isCommon) {
|
||||||
// Recursively merge objects and arrays (susceptible to call stack limits).
|
// Recursively merge objects and arrays (susceptible to call stack limits).
|
||||||
object[key] = mergeFunc(result, srcValue, customizer, stackA, stackB);
|
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;
|
object[key] = result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2572,7 +2579,7 @@
|
|||||||
if (end < 0) {
|
if (end < 0) {
|
||||||
end += length;
|
end += length;
|
||||||
}
|
}
|
||||||
length = start > end ? 0 : (end - start) >>> 0;
|
length = start > end ? 0 : ((end - start) >>> 0);
|
||||||
start >>>= 0;
|
start >>>= 0;
|
||||||
|
|
||||||
var result = Array(length);
|
var result = Array(length);
|
||||||
@@ -3043,7 +3050,8 @@
|
|||||||
var Ctor = createCtorWrapper(func);
|
var Ctor = createCtorWrapper(func);
|
||||||
|
|
||||||
function wrapper() {
|
function wrapper() {
|
||||||
return (this instanceof wrapper ? Ctor : func).apply(thisArg, arguments);
|
var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
|
||||||
|
return fn.apply(thisArg, arguments);
|
||||||
}
|
}
|
||||||
return wrapper;
|
return wrapper;
|
||||||
}
|
}
|
||||||
@@ -3070,7 +3078,7 @@
|
|||||||
return function() {
|
return function() {
|
||||||
var length = arguments.length,
|
var length = arguments.length,
|
||||||
index = length,
|
index = length,
|
||||||
fromIndex = fromRight ? length - 1 : 0;
|
fromIndex = fromRight ? (length - 1) : 0;
|
||||||
|
|
||||||
if (!length) {
|
if (!length) {
|
||||||
return function() { return arguments[0]; };
|
return function() { return arguments[0]; };
|
||||||
@@ -3246,7 +3254,8 @@
|
|||||||
if (isAry && ary < args.length) {
|
if (isAry && ary < args.length) {
|
||||||
args.length = ary;
|
args.length = ary;
|
||||||
}
|
}
|
||||||
return (this instanceof wrapper ? (Ctor || createCtorWrapper(func)) : func).apply(thisBinding, args);
|
var fn = (this && this !== root && this instanceof wrapper) ? (Ctor || createCtorWrapper(func)) : func;
|
||||||
|
return fn.apply(thisBinding, args);
|
||||||
}
|
}
|
||||||
return wrapper;
|
return wrapper;
|
||||||
}
|
}
|
||||||
@@ -3305,7 +3314,8 @@
|
|||||||
while (argsLength--) {
|
while (argsLength--) {
|
||||||
args[leftIndex++] = arguments[++argsIndex];
|
args[leftIndex++] = arguments[++argsIndex];
|
||||||
}
|
}
|
||||||
return (this instanceof wrapper ? Ctor : func).apply(isBind ? thisArg : this, args);
|
var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
|
||||||
|
return fn.apply(isBind ? thisArg : this, args);
|
||||||
}
|
}
|
||||||
return wrapper;
|
return wrapper;
|
||||||
}
|
}
|
||||||
@@ -3523,8 +3533,10 @@
|
|||||||
othCtor = other.constructor;
|
othCtor = other.constructor;
|
||||||
|
|
||||||
// Non `Object` object instances with different constructors are not equal.
|
// Non `Object` object instances with different constructors are not equal.
|
||||||
if (objCtor != othCtor && ('constructor' in object && 'constructor' in other) &&
|
if (objCtor != othCtor &&
|
||||||
!(typeof objCtor == 'function' && objCtor instanceof objCtor && typeof othCtor == 'function' && othCtor instanceof othCtor)) {
|
('constructor' in object && 'constructor' in other) &&
|
||||||
|
!(typeof objCtor == 'function' && objCtor instanceof objCtor &&
|
||||||
|
typeof othCtor == 'function' && othCtor instanceof othCtor)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3550,7 +3562,8 @@
|
|||||||
|
|
||||||
baseEach(collection, function(value, index, collection) {
|
baseEach(collection, function(value, index, collection) {
|
||||||
var current = iteratee(value, index, collection);
|
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;
|
computed = current;
|
||||||
result = value;
|
result = value;
|
||||||
}
|
}
|
||||||
@@ -3762,7 +3775,7 @@
|
|||||||
}
|
}
|
||||||
if (prereq) {
|
if (prereq) {
|
||||||
var other = object[index];
|
var other = object[index];
|
||||||
return value === value ? value === other : other !== other;
|
return value === value ? (value === other) : (other !== other);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -4623,7 +4636,10 @@
|
|||||||
var index = binaryIndex(array, value),
|
var index = binaryIndex(array, value),
|
||||||
other = array[index];
|
other = array[index];
|
||||||
|
|
||||||
return (value === value ? value === other : other !== other) ? index : -1;
|
if (value === value ? (value === other) : (other !== other)) {
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
return baseIndexOf(array, value, fromIndex || 0);
|
return baseIndexOf(array, value, fromIndex || 0);
|
||||||
}
|
}
|
||||||
@@ -4759,7 +4775,10 @@
|
|||||||
} else if (fromIndex) {
|
} else if (fromIndex) {
|
||||||
index = binaryIndex(array, value, true) - 1;
|
index = binaryIndex(array, value, true) - 1;
|
||||||
var other = array[index];
|
var other = array[index];
|
||||||
return (value === value ? value === other : other !== other) ? index : -1;
|
if (value === value ? (value === other) : (other !== other)) {
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
if (value !== value) {
|
if (value !== value) {
|
||||||
return indexOfNaN(array, index, true);
|
return indexOfNaN(array, index, true);
|
||||||
@@ -6781,13 +6800,14 @@
|
|||||||
* @param {Array|Object|string} collection The collection to iterate over.
|
* @param {Array|Object|string} collection The collection to iterate over.
|
||||||
* @param {string[]} props The property names to sort by.
|
* @param {string[]} props The property names to sort by.
|
||||||
* @param {boolean[]} orders The sort orders of `props`.
|
* @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.
|
* @returns {Array} Returns the new sorted array.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var users = [
|
* var users = [
|
||||||
* { 'user': 'barney', 'age': 36 },
|
|
||||||
* { 'user': 'fred', 'age': 40 },
|
|
||||||
* { 'user': 'barney', 'age': 26 },
|
* { 'user': 'barney', 'age': 26 },
|
||||||
|
* { 'user': 'fred', 'age': 40 },
|
||||||
|
* { 'user': 'barney', 'age': 36 },
|
||||||
* { 'user': 'fred', 'age': 30 }
|
* { 'user': 'fred', 'age': 30 }
|
||||||
* ];
|
* ];
|
||||||
*
|
*
|
||||||
@@ -8033,7 +8053,7 @@
|
|||||||
*/
|
*/
|
||||||
function isElement(value) {
|
function isElement(value) {
|
||||||
return (value && value.nodeType === 1 && isObjectLike(value) &&
|
return (value && value.nodeType === 1 && isObjectLike(value) &&
|
||||||
objToString.call(value).indexOf('Element') > -1) || false;
|
(objToString.call(value).indexOf('Element') > -1)) || false;
|
||||||
}
|
}
|
||||||
// Fallback for environments without DOM support.
|
// Fallback for environments without DOM support.
|
||||||
if (!support.dom) {
|
if (!support.dom) {
|
||||||
@@ -9037,7 +9057,7 @@
|
|||||||
length = object.length;
|
length = object.length;
|
||||||
}
|
}
|
||||||
if ((typeof Ctor == 'function' && Ctor.prototype === object) ||
|
if ((typeof Ctor == 'function' && Ctor.prototype === object) ||
|
||||||
(typeof object != 'function' && (length && isLength(length)))) {
|
(typeof object != 'function' && (length && isLength(length)))) {
|
||||||
return shimKeys(object);
|
return shimKeys(object);
|
||||||
}
|
}
|
||||||
return isObject(object) ? nativeKeys(object) : [];
|
return isObject(object) ? nativeKeys(object) : [];
|
||||||
@@ -9641,7 +9661,11 @@
|
|||||||
target = (target + '');
|
target = (target + '');
|
||||||
|
|
||||||
var length = string.length;
|
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;
|
return position >= 0 && string.indexOf(target, position) == position;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -9983,7 +10007,10 @@
|
|||||||
*/
|
*/
|
||||||
function startsWith(string, target, position) {
|
function startsWith(string, target, position) {
|
||||||
string = baseToString(string);
|
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;
|
return string.lastIndexOf(target, position) == position;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -10333,7 +10360,7 @@
|
|||||||
if (options != null) {
|
if (options != null) {
|
||||||
if (isObject(options)) {
|
if (isObject(options)) {
|
||||||
var separator = 'separator' in options ? options.separator : separator;
|
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;
|
omission = 'omission' in options ? baseToString(options.omission) : omission;
|
||||||
} else {
|
} else {
|
||||||
length = +options || 0;
|
length = +options || 0;
|
||||||
@@ -10451,7 +10478,7 @@
|
|||||||
function attempt() {
|
function attempt() {
|
||||||
var func = arguments[0],
|
var func = arguments[0],
|
||||||
length = arguments.length,
|
length = arguments.length,
|
||||||
args = Array(length ? length - 1 : 0);
|
args = Array(length ? (length - 1) : 0);
|
||||||
|
|
||||||
while (--length > 0) {
|
while (--length > 0) {
|
||||||
args[length - 1] = arguments[length];
|
args[length - 1] = arguments[length];
|
||||||
@@ -10682,7 +10709,11 @@
|
|||||||
var chainAll = this.__chain__;
|
var chainAll = this.__chain__;
|
||||||
if (chain || chainAll) {
|
if (chain || chainAll) {
|
||||||
var result = object(this.__wrapped__);
|
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;
|
result.__chain__ = chainAll;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -11345,24 +11376,35 @@
|
|||||||
result = (filtered && isDropWhile) ? new LazyWrapper(this) : this.clone(),
|
result = (filtered && isDropWhile) ? new LazyWrapper(this) : this.clone(),
|
||||||
iteratees = result.__iteratees__ || (result.__iteratees__ = []);
|
iteratees = result.__iteratees__ || (result.__iteratees__ = []);
|
||||||
|
|
||||||
|
iteratees.push({
|
||||||
|
'done': false,
|
||||||
|
'count': 0,
|
||||||
|
'index': 0,
|
||||||
|
'iteratee': getCallback(iteratee, thisArg, 1),
|
||||||
|
'limit': -1,
|
||||||
|
'type': type
|
||||||
|
});
|
||||||
|
|
||||||
result.__filtered__ = filtered || isFilter;
|
result.__filtered__ = filtered || isFilter;
|
||||||
iteratees.push({ 'done': false, 'index': 0, 'iteratee': getCallback(iteratee, thisArg, 1), 'type': type });
|
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
// Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
|
// Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
|
||||||
arrayEach(['drop', 'take'], function(methodName, index) {
|
arrayEach(['drop', 'take'], function(methodName, index) {
|
||||||
var countName = '__' + methodName + 'Count__',
|
var whileName = methodName + 'While';
|
||||||
whileName = methodName + 'While';
|
|
||||||
|
|
||||||
LazyWrapper.prototype[methodName] = function(n) {
|
LazyWrapper.prototype[methodName] = function(n) {
|
||||||
n = n == null ? 1 : nativeMax(floor(n) || 0, 0);
|
var filtered = this.__filtered__,
|
||||||
|
result = (filtered && !index) ? this.dropWhile() : this.clone();
|
||||||
|
|
||||||
var result = this.clone();
|
n = n == null ? 1 : nativeMax(floor(n) || 0, 0);
|
||||||
if (result.__filtered__) {
|
if (filtered) {
|
||||||
var value = result[countName];
|
if (index) {
|
||||||
result[countName] = index ? nativeMin(value, n) : (value + n);
|
result.__takeCount__ = nativeMin(result.__takeCount__, n);
|
||||||
|
} else {
|
||||||
|
last(result.__iteratees__).limit = n;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
var views = result.__views__ || (result.__views__ = []);
|
var views = result.__views__ || (result.__views__ = []);
|
||||||
views.push({ 'size': n, 'type': methodName + (result.__dir__ < 0 ? 'Right' : '') });
|
views.push({ 'size': n, 'type': methodName + (result.__dir__ < 0 ? 'Right' : '') });
|
||||||
@@ -11478,11 +11520,11 @@
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
// Add `Array.prototype` functions to `lodash.prototype`.
|
// Add `Array` and `String` methods to `lodash.prototype`.
|
||||||
arrayEach(['concat', 'join', 'pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
|
arrayEach(['concat', 'join', 'pop', 'push', 'replace', 'shift', 'sort', 'splice', 'split', 'unshift'], function(methodName) {
|
||||||
var func = arrayProto[methodName],
|
var func = (/^(?:replace|split)$/.test(methodName) ? stringProto : arrayProto)[methodName],
|
||||||
chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
|
chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
|
||||||
retUnwrapped = /^(?:join|pop|shift)$/.test(methodName);
|
retUnwrapped = /^(?:join|pop|replace|shift)$/.test(methodName);
|
||||||
|
|
||||||
lodash.prototype[methodName] = function() {
|
lodash.prototype[methodName] = function() {
|
||||||
var args = arguments;
|
var args = arguments;
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ define(['../internal/isLength', '../lang/isNative', '../lang/isObject', '../inte
|
|||||||
length = object.length;
|
length = object.length;
|
||||||
}
|
}
|
||||||
if ((typeof Ctor == 'function' && Ctor.prototype === object) ||
|
if ((typeof Ctor == 'function' && Ctor.prototype === object) ||
|
||||||
(typeof object != 'function' && (length && isLength(length)))) {
|
(typeof object != 'function' && (length && isLength(length)))) {
|
||||||
return shimKeys(object);
|
return shimKeys(object);
|
||||||
}
|
}
|
||||||
return isObject(object) ? nativeKeys(object) : [];
|
return isObject(object) ? nativeKeys(object) : [];
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "lodash",
|
"name": "lodash",
|
||||||
"version": "3.4.0",
|
"version": "3.5.0",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"private": true,
|
"private": true,
|
||||||
"volo": {
|
"volo": {
|
||||||
|
|||||||
@@ -29,7 +29,11 @@ define(['../internal/baseToString'], function(baseToString) {
|
|||||||
target = (target + '');
|
target = (target + '');
|
||||||
|
|
||||||
var length = string.length;
|
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;
|
return position >= 0 && string.indexOf(target, position) == position;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,10 @@ define(['../internal/baseToString'], function(baseToString) {
|
|||||||
*/
|
*/
|
||||||
function startsWith(string, target, position) {
|
function startsWith(string, target, position) {
|
||||||
string = baseToString(string);
|
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;
|
return string.lastIndexOf(target, position) == position;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ define(['../internal/baseToString', '../internal/isIterateeCall', '../lang/isObj
|
|||||||
if (options != null) {
|
if (options != null) {
|
||||||
if (isObject(options)) {
|
if (isObject(options)) {
|
||||||
var separator = 'separator' in options ? options.separator : separator;
|
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;
|
omission = 'omission' in options ? baseToString(options.omission) : omission;
|
||||||
} else {
|
} else {
|
||||||
length = +options || 0;
|
length = +options || 0;
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ define(['../lang/isError'], function(isError) {
|
|||||||
function attempt() {
|
function attempt() {
|
||||||
var func = arguments[0],
|
var func = arguments[0],
|
||||||
length = arguments.length,
|
length = arguments.length,
|
||||||
args = Array(length ? length - 1 : 0);
|
args = Array(length ? (length - 1) : 0);
|
||||||
|
|
||||||
while (--length > 0) {
|
while (--length > 0) {
|
||||||
args[length - 1] = arguments[length];
|
args[length - 1] = arguments[length];
|
||||||
|
|||||||
@@ -66,7 +66,11 @@ define(['../internal/arrayCopy', '../internal/baseFunctions', '../lang/isFunctio
|
|||||||
var chainAll = this.__chain__;
|
var chainAll = this.__chain__;
|
||||||
if (chain || chainAll) {
|
if (chain || chainAll) {
|
||||||
var result = object(this.__wrapped__);
|
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;
|
result.__chain__ = chainAll;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user