@ruleenginejs/props-parser
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

@ruleenginejs/props-parser

Installation

npm install @ruleenginejs/props-parser

Usage

file.js

// @prop('foo', 'string')
// @prop('foo', 'string', '1')
// @prop('bar', 'string', ['a', 'b', 'c'], 'b')
// @prop('baz', 'boolean', true)
export default (context, next) => {
  next();
}

app.js

const propsParser = require('@ruleenginejs/props-parser');
const fs = require('fs');

const contents = fs.readFileSync('file.js', 'utf8');
console.log(propsParser.parse(contents));

/*
[
  {
    type: 'string',
    prop: 'foo'
  },
  {
    type: 'string',
    prop: 'foo',
    default: '1'
  },
  {
    type: 'string',
    prop: 'bar',
    default: 'b',
    enum: ['a', 'b', 'c']
  },
  {
    type: 'boolean',
    prop: 'baz',
    default: true
  }
]
*/

License

Licensed under the MIT License.

Package Sidebar

Install

npm i @ruleenginejs/props-parser

Weekly Downloads

0

Version

1.0.3

License

MIT

Unpacked Size

6.6 kB

Total Files

7

Last publish

Collaborators

  • nikolaynau