@mawngo/pipe-parser
v1.5.1
Published
Declarative format parser for declarative template engines
Downloads
4
Maintainers
Readme
Pipe Parser
Declarative format parser for declarative template engines (like angular pipe)
Installation
# Using npm
npm install --save @mawngo/html-parser
Usage
const {parse, parseRaw} = require('@mawngo/pipe-parser');
parse('date:"2022-01-18"'); //=> [{name: 'date', args: ['2022-01-18']}]
parse('myfunc:1,"foo",true'); //=> [{name: 'myfunc', args:[1, 'foo', true]}]
parse('myfunc:"foo","true"'); //=> [{name: 'myfunc', args:['foo', 'true']}]
parse('trim | date:"2022-01-18"'); //=> [{name: 'trim', args:[]}, {name: 'date', args: ['2022-01-18']}]
parseRaw('myfunc:1,"foo",true') //=> [{name: 'myfunc', args:['1', 'foo', 'true']}]
// Only support simple type
parse('myfunc:{foo:"bar"}'); //=> [{name: 'myfunc', args:['{foo:"bar"}']}]