mentality-node-parser

0.1.0 • Public • Published

mentality-node-parser

Utility module used to parse layer node for mentality library.

NPM version Build Status Dependency Status Coverage percentage

Installation

  npm install --save mentality-node-parser

Basic usage

Sample JS file input.js:

/*
@form Node
@description Node description here.

@input          units
@type           number

@input          activation
@type           text
@description    Activation description here.
 */


// Some js here
let a = 1 + 2;

Parse a file.

const mentalityNodeParser = require('mentality-node-parser');
const forms = mentalityNodeParser.parseFile('input.js');

/*
[{
  name: 'Dense',
  properties: {
    type: 'text',
    description: 'Node description here'
  },
  inputs: [{
    name: 'units',
    properties: {
      type: 'number',
      required: true
    }
  }, {
    name: 'activation',
    properties: {
      type: 'text',
      description: 'Activation description here.'
    }
  }]
}]
*/

Generate HTML

const input = forms[0].inputs;

input[0].toHTML();

// <input type="number" required="true">

input[1].toHTML();

// <input type="text">

forms.toHTML()

/*
<form>
  <input type="number" required="true">
  <input type="text">
</form>
*/

Getting To Know Yeoman

Yeoman has a heart of gold. He's a person with feelings and opinions, but he's very easy to work with. If you think he's too opinionated, he can be easily convinced. Feel free to learn more about him.

Created with

Yeoman and Generator-simple-package

License

MIT © nghiattran

Dependents (0)

Package Sidebar

Install

npm i mentality-node-parser

Weekly Downloads

0

Version

0.1.0

License

MIT

Last publish

Collaborators

  • nghiattran