function-parser
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

Function call parser

Greenkeeper badge

NPM Version Build Status Test Coverage

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"
      }
    ]
  }
]*/

API

License

MIT

Package Sidebar

Install

npm i function-parser

Weekly Downloads

1

Version

0.0.3

License

MIT

Unpacked Size

10.8 kB

Total Files

7

Last publish

Collaborators

  • hiscojs