acorn-sontag

0.4.0 • Public • Published

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])

Readme

Keywords

none

Package Sidebar

Install

npm i acorn-sontag

Weekly Downloads

0

Version

0.4.0

License

MIT

Unpacked Size

9.6 kB

Total Files

5

Last publish

Collaborators

  • danburzo