 Issue 29873570:
  Issue 6923 - Only parse metadata from special comments at the top of the file  (Closed)
    
  
    Issue 29873570:
  Issue 6923 - Only parse metadata from special comments at the top of the file  (Closed) 
  | Index: lib/synchronizer.js | 
| =================================================================== | 
| --- a/lib/synchronizer.js | 
| +++ b/lib/synchronizer.js | 
| @@ -160,16 +160,18 @@ | 
| 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*(?:(\w+)\s*:\s*(.*)|\S)/.exec(lines[i]); | 
| 
Manish Jethani
2018/09/05 18:10:08
How about this one: `/^\s*!\s*([^\s:]*)\s*(:)?\s*(
 
Sebastian Noack
2018/09/06 00:56:03
Done. Not sure if it's any easier to read through.
 
Manish Jethani
2018/09/06 05:53:53
I stand corrected, I meant `match[2]`
A couple of
 
Sebastian Noack
2018/09/06 14:31:36
This is just a stop gap, what is eventually consid
 
Manish Jethani
2018/09/10 07:24:49
Acknowledged.
 | 
| + if (!match) | 
| + break; | 
| + | 
| + if (match[1] != undefined) | 
| 
Manish Jethani
2018/09/05 18:10:08
We never compare with `undefined` in core. `undefi
 
Sebastian Noack
2018/09/06 00:56:03
Actually, I cannot redefine undefined, neither thr
 
Manish Jethani
2018/09/06 05:53:53
You can just shadow `undefined` in the local scope
 | 
| { | 
| let keyword = match[1].toLowerCase(); | 
| - let value = match[2]; | 
| - if (keyword in params) | 
| + if (params.hasOwnProperty(keyword)) | 
| { | 
| - params[keyword] = value; | 
| + params[keyword] = match[2]; | 
| lines.splice(i--, 1); | 
| } | 
| } |