1.0.3 • Published 2 years ago

@ruleenginejs/props-parser v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

@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.

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago