function-parser
v0.0.3
Published
Safe function call parser
Downloads
4
Readme
Function call parser
High performace function call parser, parse text and call function with argument without eval
High perormance
Function parser is good for cases when you want to describe function calls without the string overheads of json.
Simple to use
Using Javascript
//Require all Function parser module
const FunctionParser = require('function-parser');
//Or Directly load the desired `parse`
const {parse} = require('function-parser');
//Simple usage
parse('foo(1,"bar");foo(,"bar")')
/*=> [
{
name: "foo",
args: [
1,
"bar"
]
},
{
name: "foo",
args: [
null,
"bar"
]
}
]*/
Using TypeScript
import {parse} from 'function-parser';
//Usage
parse('test({"json works": "However, for best performance it is recommended not to use json"})')
/*=> [
{
name: "test",
args: [
{
"json works": "However, for best performance it is recommended not to use json"
}
]
}
]*/