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

Delta Between Two Patch Sets: lib/synchronizer.js

Issue 29879940: Issue 6923 - Simplify parsing of metadata (Closed)
Left Patch Set: Created Sept. 13, 2018, 4:05 p.m.
Right Patch Set: Further simplify regexp Created Sept. 14, 2018, 2:27 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | test/synchronizer.js » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH 3 * Copyright (C) 2006-present eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 153
154 let params = { 154 let params = {
155 redirect: null, 155 redirect: null,
156 homepage: null, 156 homepage: null,
157 title: null, 157 title: null,
158 version: null, 158 version: null,
159 expires: null 159 expires: null
160 }; 160 };
161 for (let i = 1; i < lines.length; i++) 161 for (let i = 1; i < lines.length; i++)
162 { 162 {
163 let match = /^\s*!\s*([^:]*[^:\s])\s*:\s*(.*)/.exec(lines[i]); 163 let match = /^\s*!\s*(.*?)\s*:\s*(.*)/.exec(lines[i]);
164 if (!match) 164 if (!match)
165 break; 165 break;
166 166
167 let keyword = match[1].toLowerCase(); 167 let keyword = match[1].toLowerCase();
168 if (params.hasOwnProperty(keyword)) 168 if (params.hasOwnProperty(keyword))
169 { 169 {
170 params[keyword] = match[2]; 170 params[keyword] = match[2];
171 lines.splice(i--, 1); 171 lines.splice(i--, 1);
172 } 172 }
173 } 173 }
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 } 338 }
339 339
340 /** 340 /**
341 * This object is responsible for downloading filter subscriptions whenever 341 * This object is responsible for downloading filter subscriptions whenever
342 * necessary. 342 * necessary.
343 * @type {Synchronizer} 343 * @type {Synchronizer}
344 */ 344 */
345 let synchronizer = new Synchronizer(); 345 let synchronizer = new Synchronizer();
346 346
347 exports.Synchronizer = synchronizer; 347 exports.Synchronizer = synchronizer;
LEFTRIGHT

Powered by Google App Engine
This is Rietveld