jsdoc for allowedExpression
This commit is contained in:
Родитель
13a36c50fe
Коммит
cf8039a19a
|
@ -19,6 +19,19 @@ module.exports = function (context) {
|
|||
var VALID_ESCAPERS = ["Sanitizer.escapeHTML", "escapeHTML"];
|
||||
var VALID_UNWRAPPERS = ["Sanitizer.unwrapSafeHTML", "unwrapSafeHTML"];
|
||||
|
||||
|
||||
/**
|
||||
* Returns true if the expression contains allowed syntax, otherwise false.
|
||||
* For Template Strings with interpolation (e.g. |`${foo}`|) and
|
||||
* Binary Expressions (e.g. |foo+bar|), the function will look into the expression
|
||||
* recursively.
|
||||
* For testing and development, I recommend looking at example code and its syntax tree.
|
||||
* Using the Esprima Demo, for example: http://esprima.org/demo/parse.html
|
||||
*
|
||||
* @param {Object} expression Checks whether this node is an allowed expression.
|
||||
* @param {Object} parent Parent node of the expression node (first param)
|
||||
* @returns {boolean}
|
||||
*/
|
||||
function allowedExpression(expression, parent) {
|
||||
if (typeof parent === "undefined") {
|
||||
throw new Error("allowedExpressions() expects two parameters. Only one given.");
|
||||
|
|
Загрузка…
Ссылка в новой задаче