mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 14:37:49 +00:00
Compare commits
7 Commits
4.17.8-es
...
4.17.15-es
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4d5fdc492f | ||
|
|
15421d13b7 | ||
|
|
078664194c | ||
|
|
51c827ffd9 | ||
|
|
349273409f | ||
|
|
cc483eda91 | ||
|
|
f73db1f02c |
2
LICENSE
2
LICENSE
@@ -1,4 +1,4 @@
|
||||
Copyright JS Foundation and other contributors <https://js.foundation/>
|
||||
Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
||||
|
||||
Based on Underscore.js, copyright Jeremy Ashkenas,
|
||||
DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# lodash-es v4.17.8
|
||||
# lodash-es v4.17.15
|
||||
|
||||
The [Lodash](https://lodash.com/) library exported as [ES](http://www.ecma-international.org/ecma-262/6.0/) modules.
|
||||
|
||||
@@ -7,4 +7,4 @@ Generated using [lodash-cli](https://www.npmjs.com/package/lodash-cli):
|
||||
$ lodash modularize exports=es -o ./
|
||||
```
|
||||
|
||||
See the [package source](https://github.com/lodash/lodash/tree/4.17.8-es) for more details.
|
||||
See the [package source](https://github.com/lodash/lodash/tree/4.17.15-es) for more details.
|
||||
|
||||
@@ -140,16 +140,10 @@ function baseClone(value, bitmask, customizer, key, object, stack) {
|
||||
value.forEach(function(subValue) {
|
||||
result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
if (isMap(value)) {
|
||||
} else if (isMap(value)) {
|
||||
value.forEach(function(subValue, key) {
|
||||
result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
var keysFunc = isFull
|
||||
|
||||
@@ -22,8 +22,8 @@ function baseMerge(object, source, srcIndex, customizer, stack) {
|
||||
return;
|
||||
}
|
||||
baseFor(source, function(srcValue, key) {
|
||||
stack || (stack = new Stack);
|
||||
if (isObject(srcValue)) {
|
||||
stack || (stack = new Stack);
|
||||
baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -74,7 +74,7 @@ function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, sta
|
||||
if (isArguments(objValue)) {
|
||||
newValue = toPlainObject(objValue);
|
||||
}
|
||||
else if (!isObject(objValue) || (srcIndex && isFunction(objValue))) {
|
||||
else if (!isObject(objValue) || isFunction(objValue)) {
|
||||
newValue = initCloneObject(srcValue);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import root from './_root.js';
|
||||
import toInteger from './toInteger.js';
|
||||
import toNumber from './toNumber.js';
|
||||
import toString from './toString.js';
|
||||
|
||||
/* Built-in method references for those with the same name as other `lodash` methods. */
|
||||
var nativeMin = Math.min;
|
||||
var nativeIsFinite = root.isFinite,
|
||||
nativeMin = Math.min;
|
||||
|
||||
/**
|
||||
* Creates a function like `_.round`.
|
||||
@@ -17,7 +19,7 @@ function createRound(methodName) {
|
||||
return function(number, precision) {
|
||||
number = toNumber(number);
|
||||
precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
|
||||
if (precision) {
|
||||
if (precision && nativeIsFinite(number)) {
|
||||
// Shift with exponential notation to avoid floating-point issues.
|
||||
// See [MDN](https://mdn.io/round#Examples) for more details.
|
||||
var pair = (toString(number) + 'e').split('e'),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/** Used to detect strings that need a more robust regexp to match words. */
|
||||
var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
|
||||
var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
|
||||
|
||||
/**
|
||||
* Checks if `string` contains a word composed of Unicode symbols.
|
||||
|
||||
@@ -15,6 +15,14 @@ var freeProcess = moduleExports && freeGlobal.process;
|
||||
/** Used to access faster Node.js helpers. */
|
||||
var nodeUtil = (function() {
|
||||
try {
|
||||
// Use `util.types` for Node.js 10+.
|
||||
var types = freeModule && freeModule.require && freeModule.require('util').types;
|
||||
|
||||
if (types) {
|
||||
return types;
|
||||
}
|
||||
|
||||
// Legacy `process.binding('util')` for Node.js < 10.
|
||||
return freeProcess && freeProcess.binding && freeProcess.binding('util');
|
||||
} catch (e) {}
|
||||
}());
|
||||
|
||||
14
_safeGet.js
14
_safeGet.js
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Gets the value at `key`, unless `key` is "__proto__".
|
||||
* Gets the value at `key`, unless `key` is "__proto__" or "constructor".
|
||||
*
|
||||
* @private
|
||||
* @param {Object} object The object to query.
|
||||
@@ -7,9 +7,15 @@
|
||||
* @returns {*} Returns the property value.
|
||||
*/
|
||||
function safeGet(object, key) {
|
||||
return key == '__proto__'
|
||||
? undefined
|
||||
: object[key];
|
||||
if (key === 'constructor' && typeof object[key] === 'function') {
|
||||
return;
|
||||
}
|
||||
|
||||
if (key == '__proto__') {
|
||||
return;
|
||||
}
|
||||
|
||||
return object[key];
|
||||
}
|
||||
|
||||
export default safeGet;
|
||||
|
||||
@@ -173,6 +173,7 @@ function debounce(func, wait, options) {
|
||||
}
|
||||
if (maxing) {
|
||||
// Handle invocations in a tight loop.
|
||||
clearTimeout(timerId);
|
||||
timerId = setTimeout(timerExpired, wait);
|
||||
return invokeFunc(lastCallTime);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* @license
|
||||
* Lodash (Custom Build) <https://lodash.com/>
|
||||
* Build: `lodash modularize exports="es" -o ./`
|
||||
* Copyright JS Foundation and other contributors <https://js.foundation/>
|
||||
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
||||
* Released under MIT license <https://lodash.com/license>
|
||||
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
||||
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
||||
@@ -45,7 +45,7 @@ import toInteger from './toInteger.js';
|
||||
import lodash from './wrapperLodash.js';
|
||||
|
||||
/** Used as the semantic version number. */
|
||||
var VERSION = '4.17.8';
|
||||
var VERSION = '4.17.15';
|
||||
|
||||
/** Used to compose bitmasks for function metadata. */
|
||||
var WRAP_BIND_KEY_FLAG = 2;
|
||||
@@ -606,10 +606,11 @@ arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(method
|
||||
baseForOwn(LazyWrapper.prototype, function(func, methodName) {
|
||||
var lodashFunc = lodash[methodName];
|
||||
if (lodashFunc) {
|
||||
var key = (lodashFunc.name + ''),
|
||||
names = realNames[key] || (realNames[key] = []);
|
||||
|
||||
names.push({ 'name': methodName, 'func': lodashFunc });
|
||||
var key = lodashFunc.name + '';
|
||||
if (!hasOwnProperty.call(realNames, key)) {
|
||||
realNames[key] = [];
|
||||
}
|
||||
realNames[key].push({ 'name': methodName, 'func': lodashFunc });
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* @license
|
||||
* Lodash (Custom Build) <https://lodash.com/>
|
||||
* Build: `lodash modularize exports="es" -o ./`
|
||||
* Copyright JS Foundation and other contributors <https://js.foundation/>
|
||||
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
||||
* Released under MIT license <https://lodash.com/license>
|
||||
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
||||
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "lodash-es",
|
||||
"version": "4.17.8",
|
||||
"version": "4.17.15",
|
||||
"description": "Lodash exported as ES modules.",
|
||||
"keywords": "es6, modules, stdlib, util",
|
||||
"homepage": "https://lodash.com/custom-builds",
|
||||
@@ -11,10 +11,10 @@
|
||||
"main": "lodash.js",
|
||||
"module": "lodash.js",
|
||||
"sideEffects": false,
|
||||
"author": "John-David Dalton <john.david.dalton@gmail.com> (http://allyoucanleet.com/)",
|
||||
"author": "John-David Dalton <john.david.dalton@gmail.com>",
|
||||
"contributors": [
|
||||
"John-David Dalton <john.david.dalton@gmail.com> (http://allyoucanleet.com/)",
|
||||
"Mathias Bynens <mathias@qiwi.be> (https://mathiasbynens.be/)"
|
||||
"John-David Dalton <john.david.dalton@gmail.com>",
|
||||
"Mathias Bynens <mathias@qiwi.be>"
|
||||
],
|
||||
"scripts": { "test": "echo \"See https://travis-ci.org/lodash-archive/lodash-cli for testing details.\"" }
|
||||
}
|
||||
|
||||
19
template.js
19
template.js
@@ -27,6 +27,12 @@ var reNoMatch = /($^)/;
|
||||
/** Used to match unescaped characters in compiled string literals. */
|
||||
var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
|
||||
|
||||
/** Used for built-in method references. */
|
||||
var objectProto = Object.prototype;
|
||||
|
||||
/** Used to check objects for own properties. */
|
||||
var hasOwnProperty = objectProto.hasOwnProperty;
|
||||
|
||||
/**
|
||||
* Creates a compiled template function that can interpolate data properties
|
||||
* in "interpolate" delimiters, HTML-escape interpolated data properties in
|
||||
@@ -162,7 +168,14 @@ function template(string, options, guard) {
|
||||
, 'g');
|
||||
|
||||
// Use a sourceURL for easier debugging.
|
||||
var sourceURL = 'sourceURL' in options ? '//# sourceURL=' + options.sourceURL + '\n' : '';
|
||||
// The sourceURL gets injected into the source that's eval-ed, so be careful
|
||||
// with lookup (in case of e.g. prototype pollution), and strip newlines if any.
|
||||
// A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection.
|
||||
var sourceURL = hasOwnProperty.call(options, 'sourceURL')
|
||||
? ('//# sourceURL=' +
|
||||
(options.sourceURL + '').replace(/[\r\n]/g, ' ') +
|
||||
'\n')
|
||||
: '';
|
||||
|
||||
string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
|
||||
interpolateValue || (interpolateValue = esTemplateValue);
|
||||
@@ -193,7 +206,9 @@ function template(string, options, guard) {
|
||||
|
||||
// If `variable` is not specified wrap a with-statement around the generated
|
||||
// code to add the data object to the top of the scope chain.
|
||||
var variable = options.variable;
|
||||
// Like with sourceURL, we take care to not check the option's prototype,
|
||||
// as this configuration is a code injection vector.
|
||||
var variable = hasOwnProperty.call(options, 'variable') && options.variable;
|
||||
if (!variable) {
|
||||
source = 'with (obj) {\n' + source + '\n}\n';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user