Compare commits

..

3 Commits

Author SHA1 Message Date
John-David Dalton
f42b961697 Bump to v4.17.12. 2019-07-09 13:47:57 -07:00
John-David Dalton
db0dbd39a7 Bump to v4.17.11. 2018-09-11 22:29:45 -07:00
John-David Dalton
bbcefc5447 Bump to v4.17.10. 2018-04-24 15:30:39 -07:00
12 changed files with 83 additions and 63 deletions

View File

@@ -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, Based on Underscore.js, copyright Jeremy Ashkenas,
DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/> DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>

View File

@@ -1,4 +1,4 @@
# lodash-amd v4.17.9 # lodash-amd v4.17.12
The [Lodash](https://lodash.com/) library exported as [AMD](https://github.com/amdjs/amdjs-api/wiki/AMD) modules. The [Lodash](https://lodash.com/) library exported as [AMD](https://github.com/amdjs/amdjs-api/wiki/AMD) modules.
@@ -27,4 +27,4 @@ require({
}); });
``` ```
See the [package source](https://github.com/lodash/lodash/tree/4.17.9-amd) for more details. See the [package source](https://github.com/lodash/lodash/tree/4.17.12-amd) for more details.

View File

@@ -123,16 +123,10 @@ define(['./_Stack', './_arrayEach', './_assignValue', './_baseAssign', './_baseA
value.forEach(function(subValue) { value.forEach(function(subValue) {
result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack)); result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
}); });
} else if (isMap(value)) {
return result;
}
if (isMap(value)) {
value.forEach(function(subValue, key) { value.forEach(function(subValue, key) {
result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack)); result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
}); });
return result;
} }
var keysFunc = isFull var keysFunc = isFull

View File

@@ -19,8 +19,8 @@ define(['./_Stack', './_assignMergeValue', './_baseFor', './_baseMergeDeep', './
return; return;
} }
baseFor(source, function(srcValue, key) { baseFor(source, function(srcValue, key) {
stack || (stack = new Stack);
if (isObject(srcValue)) { if (isObject(srcValue)) {
stack || (stack = new Stack);
baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack); baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
} }
else { else {

View File

@@ -63,7 +63,7 @@ define(['./_assignMergeValue', './_cloneBuffer', './_cloneTypedArray', './_copyA
if (isArguments(objValue)) { if (isArguments(objValue)) {
newValue = toPlainObject(objValue); newValue = toPlainObject(objValue);
} }
else if (!isObject(objValue) || (srcIndex && isFunction(objValue))) { else if (!isObject(objValue) || isFunction(objValue)) {
newValue = initCloneObject(srcValue); newValue = initCloneObject(srcValue);
} }
} }

View File

@@ -1,7 +1,8 @@
define(['./toInteger', './toNumber', './toString'], function(toInteger, toNumber, toString) { define(['./toInteger', './toNumber', './toString'], function(toInteger, toNumber, toString) {
/* Built-in method references for those with the same name as other `lodash` methods. */ /* 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`. * Creates a function like `_.round`.
@@ -15,7 +16,7 @@ define(['./toInteger', './toNumber', './toString'], function(toInteger, toNumber
return function(number, precision) { return function(number, precision) {
number = toNumber(number); number = toNumber(number);
precision = precision == null ? 0 : nativeMin(toInteger(precision), 292); precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
if (precision) { if (precision && nativeIsFinite(number)) {
// Shift with exponential notation to avoid floating-point issues. // Shift with exponential notation to avoid floating-point issues.
// See [MDN](https://mdn.io/round#Examples) for more details. // See [MDN](https://mdn.io/round#Examples) for more details.
var pair = (toString(number) + 'e').split('e'), var pair = (toString(number) + 'e').split('e'),

View File

@@ -1,7 +1,7 @@
define([], function() { define([], function() {
/** Used to detect strings that need a more robust regexp to match words. */ /** 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. * Checks if `string` contains a word composed of Unicode symbols.

View File

@@ -1,10 +1,7 @@
define([], function() { define([], function() {
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
var undefined;
/** /**
* Gets the value at `key`, unless `key` is "__proto__". * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
* *
* @private * @private
* @param {Object} object The object to query. * @param {Object} object The object to query.
@@ -12,9 +9,15 @@ define([], function() {
* @returns {*} Returns the property value. * @returns {*} Returns the property value.
*/ */
function safeGet(object, key) { function safeGet(object, key) {
return key == '__proto__' if (key === 'constructor' && typeof object[key] === 'function') {
? undefined return;
: object[key]; }
if (key == '__proto__') {
return;
}
return object[key];
} }
return safeGet; return safeGet;

View File

@@ -174,6 +174,7 @@ define(['./isObject', './now', './toNumber'], function(isObject, now, toNumber)
} }
if (maxing) { if (maxing) {
// Handle invocations in a tight loop. // Handle invocations in a tight loop.
clearTimeout(timerId);
timerId = setTimeout(timerExpired, wait); timerId = setTimeout(timerExpired, wait);
return invokeFunc(lastCallTime); return invokeFunc(lastCallTime);
} }

75
main.js
View File

@@ -2,7 +2,7 @@
* @license * @license
* Lodash (Custom Build) <https://lodash.com/> * Lodash (Custom Build) <https://lodash.com/>
* Build: `lodash exports="amd" -d -o ./main.js` * Build: `lodash exports="amd" -d -o ./main.js`
* 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> * Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
@@ -13,7 +13,7 @@
var undefined; var undefined;
/** Used as the semantic version number. */ /** Used as the semantic version number. */
var VERSION = '4.17.9'; var VERSION = '4.17.12';
/** Used as the size to enable large array optimizations. */ /** Used as the size to enable large array optimizations. */
var LARGE_ARRAY_SIZE = 200; var LARGE_ARRAY_SIZE = 200;
@@ -277,7 +277,7 @@
var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']'); var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
/** Used to detect strings that need a more robust regexp to match words. */ /** 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 ]/;
/** Used to assign default `context` object properties. */ /** Used to assign default `context` object properties. */
var contextProps = [ var contextProps = [
@@ -1225,20 +1225,6 @@
return result; return result;
} }
/**
* Gets the value at `key`, unless `key` is "__proto__".
*
* @private
* @param {Object} object The object to query.
* @param {string} key The key of the property to get.
* @returns {*} Returns the property value.
*/
function safeGet(object, key) {
return key == '__proto__'
? undefined
: object[key];
}
/** /**
* Converts `set` to an array of its values. * Converts `set` to an array of its values.
* *
@@ -2686,16 +2672,10 @@
value.forEach(function(subValue) { value.forEach(function(subValue) {
result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack)); result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
}); });
} else if (isMap(value)) {
return result;
}
if (isMap(value)) {
value.forEach(function(subValue, key) { value.forEach(function(subValue, key) {
result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack)); result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
}); });
return result;
} }
var keysFunc = isFull var keysFunc = isFull
@@ -3619,8 +3599,8 @@
return; return;
} }
baseFor(source, function(srcValue, key) { baseFor(source, function(srcValue, key) {
stack || (stack = new Stack);
if (isObject(srcValue)) { if (isObject(srcValue)) {
stack || (stack = new Stack);
baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack); baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
} }
else { else {
@@ -3696,7 +3676,7 @@
if (isArguments(objValue)) { if (isArguments(objValue)) {
newValue = toPlainObject(objValue); newValue = toPlainObject(objValue);
} }
else if (!isObject(objValue) || (srcIndex && isFunction(objValue))) { else if (!isObject(objValue) || isFunction(objValue)) {
newValue = initCloneObject(srcValue); newValue = initCloneObject(srcValue);
} }
} }
@@ -5437,7 +5417,7 @@
return function(number, precision) { return function(number, precision) {
number = toNumber(number); number = toNumber(number);
precision = precision == null ? 0 : nativeMin(toInteger(precision), 292); precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
if (precision) { if (precision && nativeIsFinite(number)) {
// Shift with exponential notation to avoid floating-point issues. // Shift with exponential notation to avoid floating-point issues.
// See [MDN](https://mdn.io/round#Examples) for more details. // See [MDN](https://mdn.io/round#Examples) for more details.
var pair = (toString(number) + 'e').split('e'), var pair = (toString(number) + 'e').split('e'),
@@ -6619,6 +6599,26 @@
return array; return array;
} }
/**
* Gets the value at `key`, unless `key` is "__proto__" or "constructor".
*
* @private
* @param {Object} object The object to query.
* @param {string} key The key of the property to get.
* @returns {*} Returns the property value.
*/
function safeGet(object, key) {
if (key === 'constructor' && typeof object[key] === 'function') {
return;
}
if (key == '__proto__') {
return;
}
return object[key];
}
/** /**
* Sets metadata for `func`. * Sets metadata for `func`.
* *
@@ -10412,6 +10412,7 @@
} }
if (maxing) { if (maxing) {
// Handle invocations in a tight loop. // Handle invocations in a tight loop.
clearTimeout(timerId);
timerId = setTimeout(timerExpired, wait); timerId = setTimeout(timerExpired, wait);
return invokeFunc(lastCallTime); return invokeFunc(lastCallTime);
} }
@@ -14798,9 +14799,12 @@
, 'g'); , 'g');
// Use a sourceURL for easier debugging. // Use a sourceURL for easier debugging.
// 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 = '//# sourceURL=' + var sourceURL = '//# sourceURL=' +
('sourceURL' in options (hasOwnProperty.call(options, 'sourceURL')
? options.sourceURL ? (options.sourceURL + '').replace(/[\r\n]/g, ' ')
: ('lodash.templateSources[' + (++templateCounter) + ']') : ('lodash.templateSources[' + (++templateCounter) + ']')
) + '\n'; ) + '\n';
@@ -14833,7 +14837,9 @@
// If `variable` is not specified wrap a with-statement around the generated // 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. // 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) { if (!variable) {
source = 'with (obj) {\n' + source + '\n}\n'; source = 'with (obj) {\n' + source + '\n}\n';
} }
@@ -17038,10 +17044,11 @@
baseForOwn(LazyWrapper.prototype, function(func, methodName) { baseForOwn(LazyWrapper.prototype, function(func, methodName) {
var lodashFunc = lodash[methodName]; var lodashFunc = lodash[methodName];
if (lodashFunc) { if (lodashFunc) {
var key = (lodashFunc.name + ''), var key = lodashFunc.name + '';
names = realNames[key] || (realNames[key] = []); if (!hasOwnProperty.call(realNames, key)) {
realNames[key] = [];
names.push({ 'name': methodName, 'func': lodashFunc }); }
realNames[key].push({ 'name': methodName, 'func': lodashFunc });
} }
}); });

View File

@@ -1,6 +1,6 @@
{ {
"name": "lodash-amd", "name": "lodash-amd",
"version": "4.17.9", "version": "4.17.12",
"description": "Lodash exported as AMD modules.", "description": "Lodash exported as AMD modules.",
"keywords": "amd, modules, stdlib, util", "keywords": "amd, modules, stdlib, util",
"homepage": "https://lodash.com/custom-builds", "homepage": "https://lodash.com/custom-builds",
@@ -8,11 +8,10 @@
"repository": "lodash/lodash", "repository": "lodash/lodash",
"license": "MIT", "license": "MIT",
"main": "main.js", "main": "main.js",
"author": "John-David Dalton <john.david.dalton@gmail.com> (http://allyoucanleet.com/)", "author": "John-David Dalton <john.david.dalton@gmail.com>",
"contributors": [ "contributors": [
"John-David Dalton <john.david.dalton@gmail.com> (http://allyoucanleet.com/)", "John-David Dalton <john.david.dalton@gmail.com>",
"Blaine Bublitz <blaine.bublitz@gmail.com> (https://github.com/phated)", "Mathias Bynens <mathias@qiwi.be>"
"Mathias Bynens <mathias@qiwi.be> (https://mathiasbynens.be/)"
], ],
"scripts": { "test": "echo \"See https://travis-ci.org/lodash-archive/lodash-cli for testing details.\"" } "scripts": { "test": "echo \"See https://travis-ci.org/lodash-archive/lodash-cli for testing details.\"" }
} }

View File

@@ -20,6 +20,12 @@ define(['./assignInWith', './attempt', './_baseValues', './_customDefaultsAssign
/** Used to match unescaped characters in compiled string literals. */ /** Used to match unescaped characters in compiled string literals. */
var reUnescapedString = /['\n\r\u2028\u2029\\]/g; 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 * Creates a compiled template function that can interpolate data properties
* in "interpolate" delimiters, HTML-escape interpolated data properties in * in "interpolate" delimiters, HTML-escape interpolated data properties in
@@ -155,7 +161,14 @@ define(['./assignInWith', './attempt', './_baseValues', './_customDefaultsAssign
, 'g'); , 'g');
// Use a sourceURL for easier debugging. // 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) { string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
interpolateValue || (interpolateValue = esTemplateValue); interpolateValue || (interpolateValue = esTemplateValue);
@@ -186,7 +199,9 @@ define(['./assignInWith', './attempt', './_baseValues', './_customDefaultsAssign
// If `variable` is not specified wrap a with-statement around the generated // 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. // 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) { if (!variable) {
source = 'with (obj) {\n' + source + '\n}\n'; source = 'with (obj) {\n' + source + '\n}\n';
} }