acorn-sontag
v0.5.0
Published
Acorn plugin to parse Sontag expressions
Downloads
7
Readme
acorn-sontag
An Acorn-based parser for Sontag expressions.
Installation
# using npm
npm install acorn-sontag
# using yarn
yarn add acorn-sontag
Usage
let { expression } = require('acorn-sontag');
let result = expression('posts[posts.length - 1] | escape', {
// The scope to add to filters
filterScope: 'this.__filters__',
// The scope to add to other identifiers
identifierScope: 'this',
// The name of the range function to call
// for the `..` range operator
rangeFunction: 'this.__filters__.range',
});
console.log(result);
// => this.__filters__.escape(this.posts[this.posts.length - 1])