mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-12 03:47:50 +00:00
Cleanup build.js.
Former-commit-id: 01f5488ddba9f51344561c8df493d4f1bc6b0ef9
This commit is contained in:
8
build.js
8
build.js
@@ -580,12 +580,15 @@
|
|||||||
"'else if (thisArg) callback = iteratorBind(callback, thisArg)'"
|
"'else if (thisArg) callback = iteratorBind(callback, thisArg)'"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
// DRY out isType methods
|
// DRY out isType methods
|
||||||
(function() {
|
(function() {
|
||||||
var iteratorName = lodash.find(['forEach', 'forOwn'], function(funcName) {
|
var iteratorName = lodash.find(['forEach', 'forOwn'], function(funcName) {
|
||||||
return !isRemoved(source, funcName);
|
return !isRemoved(source, funcName);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// skip this optimization if there is no iteration method to use
|
||||||
if (!iteratorName) {
|
if (!iteratorName) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -594,6 +597,7 @@
|
|||||||
result = [],
|
result = [],
|
||||||
token = '__isTypeToken__';
|
token = '__isTypeToken__';
|
||||||
|
|
||||||
|
// build replacement code
|
||||||
lodash.forOwn({
|
lodash.forOwn({
|
||||||
'Arguments': "'[object Arguments]'",
|
'Arguments': "'[object Arguments]'",
|
||||||
'Date': 'dateClass',
|
'Date': 'dateClass',
|
||||||
@@ -607,6 +611,7 @@
|
|||||||
|
|
||||||
if (funcCode) {
|
if (funcCode) {
|
||||||
if (!snippet) {
|
if (!snippet) {
|
||||||
|
// use snippet to mark the insert position
|
||||||
snippet = funcCode;
|
snippet = funcCode;
|
||||||
}
|
}
|
||||||
funcNames.push(funcName);
|
funcNames.push(funcName);
|
||||||
@@ -674,6 +679,9 @@
|
|||||||
|
|
||||||
// remove IE `shift` and `splice` fix
|
// remove IE `shift` and `splice` fix
|
||||||
source = source.replace(/(?:\s*\/\/.*\n)*( +)if *\(value.length *=== *0[\s\S]+?\n\1}/, '');
|
source = source.replace(/(?:\s*\/\/.*\n)*( +)if *\(value.length *=== *0[\s\S]+?\n\1}/, '');
|
||||||
|
|
||||||
|
// cleanup code
|
||||||
|
source = source.replace(/^ *;\n/gm, '');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// inline `iteratorTemplate` template
|
// inline `iteratorTemplate` template
|
||||||
|
|||||||
Reference in New Issue
Block a user