| Index: lib/synchronizer.js |
| =================================================================== |
| --- a/lib/synchronizer.js |
| +++ b/lib/synchronizer.js |
| @@ -160,18 +160,17 @@ |
| version: null, |
| expires: null |
| }; |
| - for (let i = 0; i < lines.length; i++) |
| + for (let i = 1; i < lines.length; i++) |
| { |
| - let match = /^\s*!\s*(\w+)\s*:\s*(.*)/.exec(lines[i]); |
| - if (match) |
| + let match = /^\s*!\s*(\S.*?)\s*:\s*(.*)/.exec(lines[i]); |
|
Sebastian Noack
2018/09/03 18:47:13
You might wonder why I changed this regular expres
Manish Jethani
2018/09/04 07:14:41
Acknowledged.
Sebastian Noack
2018/09/04 15:32:38
You have a point there. But in this regard, IMO we
|
| + if (!match) |
| + break; |
| + |
| + let keyword = match[1].toLowerCase(); |
| + if (keyword in params) |
|
Manish Jethani
2018/09/04 07:14:41
BTW I find in my tests that `params.hasOwnProperty
Sebastian Noack
2018/09/04 14:22:06
IMO the in-operator reads much nicer, and this isn
Manish Jethani
2018/09/04 15:01:45
Acknowledged.
(Aside from performance, it's also
|
| { |
| - let keyword = match[1].toLowerCase(); |
| - let value = match[2]; |
| - if (keyword in params) |
| - { |
| - params[keyword] = value; |
| - lines.splice(i--, 1); |
| - } |
| + params[keyword] = match[2]; |
| + lines.splice(i--, 1); |
|
Manish Jethani
2018/09/04 07:14:41
Since we're considering malformed keywords as well
Sebastian Noack
2018/09/04 14:22:06
Historically, if it's not recognized as supported
Manish Jethani
2018/09/04 15:01:45
OK, fair enough. I'd like to consider not using `s
|
| } |
| } |