nano-ui-parser

1.1.8 • Public • Published

Gitter NPM version Build status Test coverage Dependency Status License Downloads

nano-ui-parser

Very simple UI descriptions texts parser

Usage

    var ui_parser = require('nano-ui-parser');
 
    var tree = ui_parser(text);
 
    console.log(tree.toString());

function parse_tree(text)

Returns Directive class tree

class: Directive

  • id {String}
  • args {String}
  • children {Array} of the same class children objects. When object hasn't children its filled with undefined value.

tree.getPath()

Returns array of nodes ids from top-root node to this.

tree.enumChildren(callback)

  • function callback(node, id, args)
    • node {Directive}
    • id {String} node id
    • args {String} node arguments

About UI files

# comment
root arguments
// comment
  sub-element-1 ererw -> werwer
    sub-sub-element-1 there is any text can be arguments
    sus-sub-element-2
-- comment
  sub-element-2
    sub-sub-element-1

Readme

Keywords

none

Package Sidebar

Install

npm i nano-ui-parser

Weekly Downloads

1

Version

1.1.8

License

MIT

Last publish

Collaborators

  • holixus