Fix _.sortBy in the mobile build.

Former-commit-id: 0af3778e89e61effbe60347d6f0bcb33d8c37a2e
This commit is contained in:
John-David Dalton
2012-07-08 03:30:16 -04:00
parent d49318582f
commit 57ae1925b1

View File

@@ -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