Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/marceljs/acorn-sontag
Acorn plugin to parse Sontag expressions
https://github.com/marceljs/acorn-sontag
Last synced: 8 days ago
JSON representation
Acorn plugin to parse Sontag expressions
- Host: GitHub
- URL: https://github.com/marceljs/acorn-sontag
- Owner: marceljs
- Created: 2019-08-05T10:18:06.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2024-07-08T14:37:52.000Z (4 months ago)
- Last Synced: 2024-10-28T13:51:11.708Z (18 days ago)
- Language: JavaScript
- Size: 40 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# acorn-sontag
An Acorn-based parser for [Sontag](https://github.com/marceljs/sontag) expressions.
## Installation
```bash
# using npm
npm install acorn-sontag# using yarn
yarn add acorn-sontag
```## Usage
```js
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])
```