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

Unified Diff: lib/filterValidation.js

Issue 4886747309670400: Noissue - Added documentation for exported functions to the "filterValidation" module (Closed)
Patch Set: Created Feb. 28, 2015, 5:47 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/filterValidation.js
===================================================================
--- a/lib/filterValidation.js
+++ b/lib/filterValidation.js
@@ -17,6 +17,17 @@
let {Filter, InvalidFilter, ElemHideBase} = require("filterClasses");
+/**
+ * Parses and validates a filter given by the user.
+ *
+ * @param {string} text
+ * @param {Boolean} [ignore_headers=false] If true, no exception is raised,
+ * but null is returned instead,
+ * if a filter list header is given.
Wladimir Palant 2015/03/02 20:45:15 I have a hard time parsing that sentence :) How a
Sebastian Noack 2015/03/03 09:07:48 Done.
+ * @return {Filter}
+ * @throws Will throw an error if filter cannot be parsed
Wladimir Palant 2015/03/02 20:45:15 Nit: "throw an exception"?
Sebastian Noack 2015/03/03 09:07:48 Done.
+ * or contains an invalid CSS selector.
+ */
function parseFilter(text, ignore_headers)
{
text = Filter.normalize(text);
@@ -58,6 +69,16 @@
}
exports.parseFilter = parseFilter;
+/**
+ * Parses and validates a newline-separated list of filters given by the user.
+ *
+ * @param {string} text
+ * @param {Boolean} [ignore_headers=false] If true, filter list
+ * headers are stripped.
Wladimir Palant 2015/03/02 20:45:15 "If true, filter list headers will be stripped ins
Sebastian Noack 2015/03/03 09:07:48 Done.
+ * @return {Filter[]}
+ * @throws Will throw an error if one of the filters cannot
+ be parsed or contains an invalid CSS selector.
+ */
function parseFilters(text, ignore_headers)
{
let lines = text.split("\n");
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld