Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/synchronizer.js

Issue 29879940: Issue 6923 - Simplify parsing of metadata (Closed)
Patch Set: Further simplify regexp Created Sept. 14, 2018, 2:27 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/synchronizer.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/synchronizer.js
===================================================================
--- a/lib/synchronizer.js
+++ b/lib/synchronizer.js
@@ -160,18 +160,15 @@
};
for (let i = 1; i < lines.length; i++)
{
- let match = /^\s*!\s*(?:(\w+)\s*:\s*(.*)|\S)/.exec(lines[i]);
+ let match = /^\s*!\s*(.*?)\s*:\s*(.*)/.exec(lines[i]);
if (!match)
break;
- if (typeof match[1] != "undefined")
+ let keyword = match[1].toLowerCase();
+ if (params.hasOwnProperty(keyword))
{
- let keyword = match[1].toLowerCase();
- if (params.hasOwnProperty(keyword))
- {
- params[keyword] = match[2];
- lines.splice(i--, 1);
- }
+ params[keyword] = match[2];
+ lines.splice(i--, 1);
}
}
« no previous file with comments | « no previous file | test/synchronizer.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld