mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-04 00:57:48 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1e05116bcb |
@@ -1,4 +1,4 @@
|
|||||||
# lodash-es v3.3.0
|
# lodash-es v3.3.1
|
||||||
|
|
||||||
The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash](https://lodash.com/) exported as [ES](https://people.mozilla.org/~jorendorff/es6-draft.html) modules.
|
The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash](https://lodash.com/) exported as [ES](https://people.mozilla.org/~jorendorff/es6-draft.html) modules.
|
||||||
|
|
||||||
@@ -7,4 +7,4 @@ Generated using [lodash-cli](https://www.npmjs.com/package/lodash-cli):
|
|||||||
$ lodash modularize modern exports=es -o ./
|
$ lodash modularize modern exports=es -o ./
|
||||||
```
|
```
|
||||||
|
|
||||||
See the [package source](https://github.com/lodash/lodash/tree/3.3.0-es) for more details.
|
See the [package source](https://github.com/lodash/lodash/tree/3.3.1-es) for more details.
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ import baseCallback from '../internal/baseCallback';
|
|||||||
* // => 2
|
* // => 2
|
||||||
*
|
*
|
||||||
* // using the `_.matches` callback shorthand
|
* // using the `_.matches` callback shorthand
|
||||||
* _.findLastIndex(users, { user': 'barney', 'active': true });
|
* _.findLastIndex(users, { 'user': 'barney', 'active': true });
|
||||||
* // => 0
|
* // => 0
|
||||||
*
|
*
|
||||||
* // using the `_.matchesProperty` callback shorthand
|
* // using the `_.matchesProperty` callback shorthand
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ var nativeMax = Math.max;
|
|||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* _.indexOf([1, 2, 1, 2], 2);
|
* _.indexOf([1, 2, 1, 2], 2);
|
||||||
* // => 2
|
* // => 1
|
||||||
*
|
*
|
||||||
* // using `fromIndex`
|
* // using `fromIndex`
|
||||||
* _.indexOf([1, 2, 1, 2], 2, 2);
|
* _.indexOf([1, 2, 1, 2], 2, 2);
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ function intersection() {
|
|||||||
var value = arguments[argsIndex];
|
var value = arguments[argsIndex];
|
||||||
if (isArray(value) || isArguments(value)) {
|
if (isArray(value) || isArguments(value)) {
|
||||||
args.push(value);
|
args.push(value);
|
||||||
caches.push(isCommon && value.length >= 120 && createCache(argsIndex && value));
|
caches.push((isCommon && value.length >= 120) ? createCache(argsIndex && value) : null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
argsLength = args.length;
|
argsLength = args.length;
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ import isArray from '../lang/isArray';
|
|||||||
* ];
|
* ];
|
||||||
*
|
*
|
||||||
* // using the `_.matches` callback shorthand
|
* // using the `_.matches` callback shorthand
|
||||||
* _.some(users, { user': 'barney', 'active': false });
|
* _.some(users, { 'user': 'barney', 'active': false });
|
||||||
* // => false
|
* // => false
|
||||||
*
|
*
|
||||||
* // using the `_.matchesProperty` callback shorthand
|
* // using the `_.matchesProperty` callback shorthand
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ var nativeMax = Math.max;
|
|||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @category Function
|
* @category Function
|
||||||
* @param {Function} func The function to debounce.
|
* @param {Function} func The function to debounce.
|
||||||
* @param {number} wait The number of milliseconds to delay.
|
* @param {number} [wait=0] The number of milliseconds to delay.
|
||||||
* @param {Object} [options] The options object.
|
* @param {Object} [options] The options object.
|
||||||
* @param {boolean} [options.leading=false] Specify invoking on the leading
|
* @param {boolean} [options.leading=false] Specify invoking on the leading
|
||||||
* edge of the timeout.
|
* edge of the timeout.
|
||||||
@@ -84,7 +84,7 @@ function debounce(func, wait, options) {
|
|||||||
if (typeof func != 'function') {
|
if (typeof func != 'function') {
|
||||||
throw new TypeError(FUNC_ERROR_TEXT);
|
throw new TypeError(FUNC_ERROR_TEXT);
|
||||||
}
|
}
|
||||||
wait = wait < 0 ? 0 : wait;
|
wait = wait < 0 ? 0 : (+wait || 0);
|
||||||
if (options === true) {
|
if (options === true) {
|
||||||
var leading = true;
|
var leading = true;
|
||||||
trailing = false;
|
trailing = false;
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ var debounceOptions = {
|
|||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @category Function
|
* @category Function
|
||||||
* @param {Function} func The function to throttle.
|
* @param {Function} func The function to throttle.
|
||||||
* @param {number} wait The number of milliseconds to throttle invocations to.
|
* @param {number} [wait=0] The number of milliseconds to throttle invocations to.
|
||||||
* @param {Object} [options] The options object.
|
* @param {Object} [options] The options object.
|
||||||
* @param {boolean} [options.leading=true] Specify invoking on the leading
|
* @param {boolean} [options.leading=true] Specify invoking on the leading
|
||||||
* edge of the timeout.
|
* edge of the timeout.
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ function baseDifference(array, values) {
|
|||||||
var index = -1,
|
var index = -1,
|
||||||
indexOf = baseIndexOf,
|
indexOf = baseIndexOf,
|
||||||
isCommon = true,
|
isCommon = true,
|
||||||
cache = isCommon && values.length >= 200 && createCache(values),
|
cache = (isCommon && values.length >= 200) ? createCache(values) : null,
|
||||||
valuesLength = values.length;
|
valuesLength = values.length;
|
||||||
|
|
||||||
if (cache) {
|
if (cache) {
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ function baseUniq(array, iteratee) {
|
|||||||
length = array.length,
|
length = array.length,
|
||||||
isCommon = true,
|
isCommon = true,
|
||||||
isLarge = isCommon && length >= 200,
|
isLarge = isCommon && length >= 200,
|
||||||
seen = isLarge && createCache(),
|
seen = isLarge ? createCache() : null,
|
||||||
result = [];
|
result = [];
|
||||||
|
|
||||||
if (seen) {
|
if (seen) {
|
||||||
|
|||||||
@@ -22,8 +22,11 @@ function isIterateeCall(value, index, object) {
|
|||||||
} else {
|
} else {
|
||||||
prereq = type == 'string' && index in object;
|
prereq = type == 'string' && index in object;
|
||||||
}
|
}
|
||||||
var other = object[index];
|
if (prereq) {
|
||||||
return prereq && (value === value ? value === other : other !== other);
|
var other = object[index];
|
||||||
|
return value === value ? value === other : other !== other;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default isIterateeCall;
|
export default isIterateeCall;
|
||||||
|
|||||||
19
lodash.js
19
lodash.js
@@ -1,9 +1,9 @@
|
|||||||
/**
|
/**
|
||||||
* @license
|
* @license
|
||||||
* lodash 3.3.0 (Custom Build) <https://lodash.com/>
|
* lodash 3.3.1 (Custom Build) <https://lodash.com/>
|
||||||
* Build: `lodash modularize modern exports="es" -o ./`
|
* Build: `lodash modularize modern exports="es" -o ./`
|
||||||
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
|
* 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
|
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
||||||
* Available under MIT license <https://lodash.com/license>
|
* Available under MIT license <https://lodash.com/license>
|
||||||
*/
|
*/
|
||||||
@@ -38,7 +38,7 @@ import support from './support';
|
|||||||
import thru from './chain/thru';
|
import thru from './chain/thru';
|
||||||
|
|
||||||
/** Used as the semantic version number. */
|
/** Used as the semantic version number. */
|
||||||
var VERSION = '3.3.0';
|
var VERSION = '3.3.1';
|
||||||
|
|
||||||
/** Used to indicate the type of lazy iteratees. */
|
/** Used to indicate the type of lazy iteratees. */
|
||||||
var LAZY_FILTER_FLAG = 0,
|
var LAZY_FILTER_FLAG = 0,
|
||||||
@@ -320,15 +320,13 @@ arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'],
|
|||||||
|
|
||||||
// Add `LazyWrapper` methods that accept an `iteratee` value.
|
// Add `LazyWrapper` methods that accept an `iteratee` value.
|
||||||
arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
|
arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
|
||||||
var isFilter = index == LAZY_FILTER_FLAG,
|
var isFilter = index == LAZY_FILTER_FLAG || index == LAZY_WHILE_FLAG;
|
||||||
isWhile = index == LAZY_WHILE_FLAG;
|
|
||||||
|
|
||||||
LazyWrapper.prototype[methodName] = function(iteratee, thisArg) {
|
LazyWrapper.prototype[methodName] = function(iteratee, thisArg) {
|
||||||
var result = this.clone(),
|
var result = this.clone(),
|
||||||
filtered = result.__filtered__,
|
|
||||||
iteratees = result.__iteratees__ || (result.__iteratees__ = []);
|
iteratees = result.__iteratees__ || (result.__iteratees__ = []);
|
||||||
|
|
||||||
result.__filtered__ = filtered || isFilter || (isWhile && result.__dir__ < 0);
|
result.__filtered__ = result.__filtered__ || isFilter;
|
||||||
iteratees.push({ 'iteratee': baseCallback(iteratee, thisArg, 3), 'type': index });
|
iteratees.push({ 'iteratee': baseCallback(iteratee, thisArg, 3), 'type': index });
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
@@ -395,9 +393,14 @@ LazyWrapper.prototype.compact = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
LazyWrapper.prototype.dropWhile = function(predicate, thisArg) {
|
LazyWrapper.prototype.dropWhile = function(predicate, thisArg) {
|
||||||
var done;
|
var done,
|
||||||
|
lastIndex,
|
||||||
|
isRight = this.__dir__ < 0;
|
||||||
|
|
||||||
predicate = baseCallback(predicate, thisArg, 3);
|
predicate = baseCallback(predicate, thisArg, 3);
|
||||||
return this.filter(function(value, index, array) {
|
return this.filter(function(value, index, array) {
|
||||||
|
done = done && (isRight ? index < lastIndex : index > lastIndex);
|
||||||
|
lastIndex = index;
|
||||||
return done || (done = !predicate(value, index, array));
|
return done || (done = !predicate(value, index, array));
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "lodash-es",
|
"name": "lodash-es",
|
||||||
"version": "3.3.0",
|
"version": "3.3.1",
|
||||||
"description": "The modern build of lodash exported as ES modules.",
|
"description": "The modern build of lodash exported as ES modules.",
|
||||||
"homepage": "https://lodash.com/custom-builds",
|
"homepage": "https://lodash.com/custom-builds",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|||||||
@@ -111,10 +111,10 @@ var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
|
|||||||
* var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
|
* var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
|
||||||
* compiled.source;
|
* compiled.source;
|
||||||
* // => function(data) {
|
* // => function(data) {
|
||||||
* var __t, __p = '';
|
* // var __t, __p = '';
|
||||||
* __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
|
* // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
|
||||||
* return __p;
|
* // return __p;
|
||||||
* }
|
* // }
|
||||||
*
|
*
|
||||||
* // using the `source` property to inline compiled templates for meaningful
|
* // using the `source` property to inline compiled templates for meaningful
|
||||||
* // line numbers in error messages and a stack trace
|
* // line numbers in error messages and a stack trace
|
||||||
|
|||||||
Reference in New Issue
Block a user