mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 19:07:49 +00:00
Minify dependencyObject properties correctly.
Former-commit-id: a0d57812420a347938a438d9ecb13467401bcc96
This commit is contained in:
@@ -331,6 +331,11 @@
|
|||||||
'sortBy'
|
'sortBy'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
var depObjProps = [
|
||||||
|
'isEqual',
|
||||||
|
'keys'
|
||||||
|
];
|
||||||
|
|
||||||
var props = [
|
var props = [
|
||||||
'cache',
|
'cache',
|
||||||
'criteria',
|
'criteria',
|
||||||
@@ -339,18 +344,19 @@
|
|||||||
];
|
];
|
||||||
|
|
||||||
// minify `dependencyObject` properties
|
// minify `dependencyObject` properties
|
||||||
source = source.replace(/\b(dependencyObject(?:\.|\['))\w+/g, function(match, prelude) {
|
depObjProps.forEach(function(prop, index) {
|
||||||
return prelude + minNames[iteratorOptions.length + props.length];
|
source = source.replace(RegExp("\\b(dependencyObject(?:\\.|\\['))" + prop + '\\b', 'g'), function(match, prelude) {
|
||||||
|
return prelude + minNames[iteratorOptions.length + props.length + index];
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// minify other properties used in functions
|
||||||
var snippets = source.match(RegExp('^( *)(?:var|function) +(?:' + funcNames.join('|') + ')\\b[\\s\\S]+?\\n\\1}', 'gm'));
|
var snippets = source.match(RegExp('^( *)(?:var|function) +(?:' + funcNames.join('|') + ')\\b[\\s\\S]+?\\n\\1}', 'gm'));
|
||||||
if (!snippets) {
|
if (!snippets) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
snippets.forEach(function(snippet) {
|
snippets.forEach(function(snippet) {
|
||||||
var modified = snippet;
|
var modified = snippet;
|
||||||
|
|
||||||
// minify properties
|
|
||||||
props.forEach(function(prop, index) {
|
props.forEach(function(prop, index) {
|
||||||
// use minified names different than those chosen for `iteratorOptions`
|
// use minified names different than those chosen for `iteratorOptions`
|
||||||
var minName = minNames[iteratorOptions.length + index],
|
var minName = minNames[iteratorOptions.length + index],
|
||||||
|
|||||||
Reference in New Issue
Block a user