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

Side by Side Diff: lib/filterValidation.js

Issue 6445129351036928: Noissue - Fixed issue where JsDoc documented module functions incorrectly (Closed)
Patch Set: Created April 15, 2015, 3:52 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/filterComposer.js ('k') | lib/icon.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 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 11 matching lines...) Expand all
22 /** 22 /**
23 * Parses and validates a filter given by the user. 23 * Parses and validates a filter given by the user.
24 * 24 *
25 * @param {string} text 25 * @param {string} text
26 * @param {Boolean} [ignoreHeaders=false] If true, no exception is raised 26 * @param {Boolean} [ignoreHeaders=false] If true, no exception is raised
27 * for filter list headers, instead 27 * for filter list headers, instead
28 * the function will return null. 28 * the function will return null.
29 * @return {Filter} 29 * @return {Filter}
30 * @throws Will throw an exception if filter cannot be 30 * @throws Will throw an exception if filter cannot be
31 * parsed or contains an invalid CSS selector. 31 * parsed or contains an invalid CSS selector.
32 * @static
32 */ 33 */
33 function parseFilter(text, ignoreHeaders) 34 function parseFilter(text, ignoreHeaders)
34 { 35 {
35 text = Filter.normalize(text); 36 text = Filter.normalize(text);
36 if (!text) 37 if (!text)
37 return null; 38 return null;
38 39
39 if (text[0] == "[") 40 if (text[0] == "[")
40 { 41 {
41 if (ignoreHeaders) 42 if (ignoreHeaders)
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 * Parses and validates a newline-separated list of filters given by the user. 76 * Parses and validates a newline-separated list of filters given by the user.
76 * 77 *
77 * @param {string} text 78 * @param {string} text
78 * @param {Boolean} [ignoreHeaders=false] If true, filter list headers 79 * @param {Boolean} [ignoreHeaders=false] If true, filter list headers
79 * will be stripped instead of 80 * will be stripped instead of
80 * raising an exception. 81 * raising an exception.
81 * @return {Filter[]} 82 * @return {Filter[]}
82 * @throws Will throw an exception if one of the filters cannot 83 * @throws Will throw an exception if one of the filters cannot
83 be parsed or contains an invalid CSS selector. 84 be parsed or contains an invalid CSS selector.
84 */ 85 */
85 function parseFilters(text, ignoreHeaders) 86 exports.parseFilters = function(text, ignoreHeaders)
86 { 87 {
87 let lines = text.split("\n"); 88 let lines = text.split("\n");
88 let filters = []; 89 let filters = [];
89 90
90 for (let i = 0; i < lines.length; i++) 91 for (let i = 0; i < lines.length; i++)
91 { 92 {
92 let filter; 93 let filter;
93 try 94 try
94 { 95 {
95 filter = parseFilter(lines[i], ignoreHeaders); 96 filter = parseFilter(lines[i], ignoreHeaders);
96 } 97 }
97 catch (error) 98 catch (error)
98 { 99 {
99 throw ext.i18n.getMessage("line", (i + 1).toString()) + ": " + error; 100 throw ext.i18n.getMessage("line", (i + 1).toString()) + ": " + error;
100 } 101 }
101 102
102 if (filter) 103 if (filter)
103 filters.push(filter); 104 filters.push(filter);
104 } 105 }
105 106
106 return filters; 107 return filters;
107 } 108 };
108 exports.parseFilters = parseFilters;
OLDNEW
« no previous file with comments | « lib/filterComposer.js ('k') | lib/icon.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld