Merge pull request #25 from pbu88/small_perf_improvement

Extracts variables out of a loop
This commit is contained in:
Rodrigo Fernandes 2015-10-20 11:29:09 +01:00
commit cc858a24f9

View file

@ -119,13 +119,6 @@
}; };
var diffLines = diffInput.split('\n'); var diffLines = diffInput.split('\n');
diffLines.forEach(function(line) {
// Unmerged paths, and possibly other non-diffable files
// https://github.com/scottgonzalez/pretty-diff/issues/11
// Also, remove some useless lines
if (!line || utils.startsWith(line, '*')) {
return;
}
/* Diff */ /* Diff */
var oldMode = /^old mode (\d{6})/; var oldMode = /^old mode (\d{6})/;
@ -149,6 +142,14 @@
var combinedNewFile = /^new file mode (\d{6})/; var combinedNewFile = /^new file mode (\d{6})/;
var combinedDeletedFile = /^deleted file mode (\d{6}),(\d{6})/; var combinedDeletedFile = /^deleted file mode (\d{6}),(\d{6})/;
diffLines.forEach(function(line) {
// Unmerged paths, and possibly other non-diffable files
// https://github.com/scottgonzalez/pretty-diff/issues/11
// Also, remove some useless lines
if (!line || utils.startsWith(line, '*')) {
return;
}
var values = []; var values = [];
if (utils.startsWith(line, 'diff')) { if (utils.startsWith(line, 'diff')) {
startFile(); startFile();