Skip to content

Holixus/nano-ui-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Very simple UI descriptions texts parser

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published