Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function parse(text) {
const nunjParsed = nunjucks.parse(text);
const normalised = ast.normalize(nunjParsed);
normalised.raw = text;
return normalised;
}
const parseString = (str, opts) => {
if (opts && opts.trim === true) {
str = str.trim();
}
var node = ast.normalize(parser.parse(str));
if (opts && opts.verbose) {
node = ast.walk(node, n => {
n.parent = n.parent ? n.parent.type : null
});
} else if (opts && opts.clean === true) {
node = ast.clean(node);
}
return node;
};