mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 10:57:49 +00:00
Remove Error enum fixes/code from builds that don't need them.
Former-commit-id: db060ff3571ef656709447970b62f4af753ea0cb
This commit is contained in:
22
build.js
22
build.js
@@ -1300,9 +1300,7 @@
|
|||||||
|
|
||||||
// remove `support.nonEnumShadows` from `iteratorTemplate`
|
// remove `support.nonEnumShadows` from `iteratorTemplate`
|
||||||
source = source.replace(getIteratorTemplate(source), function(match) {
|
source = source.replace(getIteratorTemplate(source), function(match) {
|
||||||
return match
|
return match.replace(/(?: *\/\/.*\n)* *["']( *)<% *if *\(support\.nonEnumShadows[\s\S]+?["']\1<% *} *%>.+/, '');
|
||||||
.replace(/\s*\|\|\s*support\.nonEnumShadows/, '')
|
|
||||||
.replace(/(?: *\/\/.*\n)* *["']( *)<% *if *\(support\.nonEnumShadows[\s\S]+?["']\1<% *} *%>.+/, '');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return source;
|
return source;
|
||||||
@@ -1826,10 +1824,9 @@
|
|||||||
dependencyMap.reduceRight = _.without(dependencyMap.reduceRight, 'isString');
|
dependencyMap.reduceRight = _.without(dependencyMap.reduceRight, 'isString');
|
||||||
|
|
||||||
if (!isMobile) {
|
if (!isMobile) {
|
||||||
dependencyMap.isEmpty = _.without(dependencyMap.isEmpty, 'isArguments');
|
_.each(['isEmpty', 'isEqual', 'isPlainObject', 'keys'], function(methodName) {
|
||||||
dependencyMap.isEqual = _.without(dependencyMap.isEqual, 'isArguments');
|
dependencyMap[methodName] = _.without(dependencyMap[methodName], 'isArguments');
|
||||||
dependencyMap.isPlainObject = _.without(dependencyMap.isPlainObject, 'isArguments');
|
});
|
||||||
dependencyMap.keys = _.without(dependencyMap.keys, 'isArguments');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isUnderscore) {
|
if (isUnderscore) {
|
||||||
@@ -3160,6 +3157,17 @@
|
|||||||
if (_.size(source.match(/\bfreeExports\b/g)) < 2) {
|
if (_.size(source.match(/\bfreeExports\b/g)) < 2) {
|
||||||
source = removeVar(source, 'freeExports');
|
source = removeVar(source, 'freeExports');
|
||||||
}
|
}
|
||||||
|
if (!/^ *support\.(?:skipErrorProps|nonEnumShadows) *=/m.test(source)) {
|
||||||
|
source = removeVar(source, 'Error');
|
||||||
|
source = removeVar(source, 'errorProto');
|
||||||
|
source = removeFromCreateIterator(source, 'errorClass');
|
||||||
|
source = removeFromCreateIterator(source, 'errorProto');
|
||||||
|
|
||||||
|
// remove 'Error' from the `contextProps` array
|
||||||
|
source = source.replace(/^ *var contextProps *=[\s\S]+?;/m, function(match) {
|
||||||
|
return match.replace(/'Error', */, '');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
debugSource = cleanupSource(source);
|
debugSource = cleanupSource(source);
|
||||||
source = cleanupSource(source);
|
source = cleanupSource(source);
|
||||||
|
|||||||
15
lodash.js
15
lodash.js
@@ -218,7 +218,6 @@
|
|||||||
ctorByClass[arrayClass] = Array;
|
ctorByClass[arrayClass] = Array;
|
||||||
ctorByClass[boolClass] = Boolean;
|
ctorByClass[boolClass] = Boolean;
|
||||||
ctorByClass[dateClass] = Date;
|
ctorByClass[dateClass] = Date;
|
||||||
ctorByClass[errorClass] = Error;
|
|
||||||
ctorByClass[funcClass] = Function;
|
ctorByClass[funcClass] = Function;
|
||||||
ctorByClass[objectClass] = Object;
|
ctorByClass[objectClass] = Object;
|
||||||
ctorByClass[numberClass] = Number;
|
ctorByClass[numberClass] = Number;
|
||||||
@@ -563,7 +562,7 @@
|
|||||||
' <% } %>' +
|
' <% } %>' +
|
||||||
|
|
||||||
// avoid iterating over `Error.prototype` properties in older IE and Safari
|
// avoid iterating over `Error.prototype` properties in older IE and Safari
|
||||||
' <% if (support.enumErrorProps || support.nonEnumShadows) { %>\n' +
|
' <% if (support.enumErrorProps) { %>\n' +
|
||||||
' var skipErrorProps = iterable === errorProto || iterable instanceof Error;\n' +
|
' var skipErrorProps = iterable === errorProto || iterable instanceof Error;\n' +
|
||||||
' <% } %>' +
|
' <% } %>' +
|
||||||
|
|
||||||
@@ -825,16 +824,16 @@
|
|||||||
|
|
||||||
// create the function factory
|
// create the function factory
|
||||||
var factory = Function(
|
var factory = Function(
|
||||||
'ctorByClass, errorClass, errorProto, hasOwnProperty, isArguments, ' +
|
'errorClass, errorProto, hasOwnProperty, isArguments, isArray, isString, ' +
|
||||||
'isArray, isString, keys, lodash, objectProto, objectTypes, nonEnumProps, ' +
|
'keys, lodash, objectProto, objectTypes, nonEnumProps, stringClass, ' +
|
||||||
'stringClass, stringProto, toString',
|
'stringProto, toString',
|
||||||
'return function(' + args + ') {\n' + iteratorTemplate(data) + '\n}'
|
'return function(' + args + ') {\n' + iteratorTemplate(data) + '\n}'
|
||||||
);
|
);
|
||||||
// return the compiled function
|
// return the compiled function
|
||||||
return factory(
|
return factory(
|
||||||
ctorByClass, errorClass, errorProto, hasOwnProperty, isArguments,
|
errorClass, errorProto, hasOwnProperty, isArguments, isArray, isString,
|
||||||
isArray, isString, keys, lodash, objectProto, objectTypes, nonEnumProps,
|
keys, lodash, objectProto, objectTypes, nonEnumProps, stringClass,
|
||||||
stringClass, stringProto, toString
|
stringProto, toString
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user