mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-31 15:27:50 +00:00
Fix _.sortBy in the mobile build.
Former-commit-id: 0af3778e89e61effbe60347d6f0bcb33d8c37a2e
This commit is contained in:
@@ -257,10 +257,18 @@
|
||||
return;
|
||||
}
|
||||
snippets.forEach(function(snippet) {
|
||||
var result = snippet;
|
||||
var result = snippet,
|
||||
isSortBy = /var sortBy\b/.test(result);
|
||||
|
||||
// minify properties
|
||||
properties.forEach(function(property, index) {
|
||||
// add quotes around properties in the inlined method of the mobile build
|
||||
// so Closure Compiler won't mung them
|
||||
if (isSortBy) {
|
||||
result = result
|
||||
.replace(RegExp('\\.' + property + '\\b', 'g'), "['" + minNames[index] + "']")
|
||||
.replace(RegExp('\\b' + property + ' *:', 'g'), "'" + minNames[index] + "':");
|
||||
}
|
||||
result = result.replace(RegExp('\\b' + property + '\\b', 'g'), minNames[index]);
|
||||
});
|
||||
// replace with modified snippet
|
||||
|
||||
Reference in New Issue
Block a user