mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-05 17:37:50 +00:00
Reduce the size of lodash.underscore.min.js.
Former-commit-id: fd7d512e104c6325a38a7d0e09015235ca69b1da
This commit is contained in:
12
build.js
12
build.js
@@ -1050,6 +1050,18 @@
|
||||
source = removeVar(source, 'arrayLikeClasses');
|
||||
source = removeVar(source, 'cloneableClasses');
|
||||
|
||||
// remove large array optimizations from `cachedContains`
|
||||
source = source.replace(/( +)function cachedContains[\s\S]+?\n\1}/, [
|
||||
' function cachedContains(array, fromIndex) {',
|
||||
' return function(value) {',
|
||||
' return indexOf(array, value, fromIndex || 0) > -1;',
|
||||
' };',
|
||||
' }'
|
||||
].join('\n'));
|
||||
|
||||
// reduce the number of arguments passed to `cachedContains` from 3 to 2
|
||||
source = source.replace(/(cachedContains\(\w+, *\w+), *\w+/g, '$1');
|
||||
|
||||
// replace `arrayLikeClasses` in `_.isEmpty`
|
||||
source = source.replace(/'if *\(arrayLikeClasses[\s\S]+?' \|\|\\n/, "'if (isArray(value) || className == stringClass ||");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user