ze-helpers

0.0.1 • Public • Published

zeHelpers

zeRusski's little helpers

> npm install ze-helpers
var pp = require("ze-helpers").prettyPrint;
pp(ast, {prompt: "ast"}); //where ast is some object

// or you can write into a string
pp(ast, {stringify: true});

Sample output looks like this:

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
                                                                       ast 
[ 'stmts',
  [ 'stmt',
    [ 'spacesAndComments', [] ],
    [ 'template',
      [ [ 'commaList',
          [ 'pred',
            [ 'block',
              [ [ 'spacesAndComments', [] ],
                [ 'name', 'block' ],
                [ 'spacesAndComments', [ [ 'spaces', ' ' ] ] ],
                [ 'value', [ 'string', 'logo' ] ],
                [ 'spacesAndComments', [ [ 'spaces', ' ' ] ] ] ] ] ] ],
        [ 'spacesAndComments', [] ],
        [ 'templateBlock',
          [ 'stmts',
            [ 'stmt',
              [ 'spacesAndComments', [ [ 'spaces', '\n  ' ] ] ],
              [ 'template',
                [ [ 'commaList',
                    [ 'pred',
                      [ 'stdMode',
                        [ 'spacesAndComments', [] ],
                        [ 'name', 'tag' ],
                        [ 'spacesAndComments', [] ] ] ] ],
                  [ 'spacesAndComments', [] ],
                  [ 'body',
                    [ [ 'spacesAndComments', [ [ 'spaces', ' ' ] ] ],
                      [ 'literal', [ 'string', '\'', [ 'i', 'm', 'g' ] ] ],
                      [ 'spacesAndComments',
                        [ [ 'spaces', '                                 ' ],
                          [ 'comment', '// end of line comment' ],
                          [ 'spaces', '\n  ' ] ] ] ] ] ] ],
              [ 'stmtEnd' ],
              [ 'spacesAndComments', [] ] ],
            [ 'stmt',
              [ 'spacesAndComments', [] ],
              [ 'template',
                [ [ 'commaList',
                    [ 'pred',
                      [ 'stdMode',
                        [ 'spacesAndComments', [] ],
                        [ 'name', 'attrs' ],
                        [ 'spacesAndComments', [] ] ] ] ],
                  [ 'spacesAndComments', [] ],
                  [ 'body',
                    [ [ 'spacesAndComments', [ [ 'spaces', ' ' ] ] ],
                      [ 'literal',
                        [ 'bracketedExpr',
                          [ 'spacesAndComments', [] ],
                          [ 'obj',
                            [ 'commaList',
                              [ 'objItem',
                                [ 'spacesAndComments', [] ],
                                [ 'name', 'alt' ],
                                [ 'spacesAndComments', [] ],
                                [ 'spacesAndComments', [ [ 'spaces', ' ' ] ] ],
                                [ 'string', '\'', [ 'l', 'o', 'g', 'o' ] ],
                                [ 'spacesAndComments', [] ] ],
                              [ 'objItem',
                                [ 'spacesAndComments', [ [ 'spaces', ' ' ] ] ],
                                [ 'name', 'href' ],
                                [ 'spacesAndComments', [] ],
                                [ 'spacesAndComments', [ [ 'spaces', ' ' ] ] ],
                                [ 'string',
                                  '\'',
                                  [ 'h', 't', 't', 'p', ':', '/', '/', '.', '.', '.' ] ],
                                [ 'spacesAndComments', [] ] ] ] ],
                          [ 'spacesAndComments', [] ] ] ],
                      [ 'spacesAndComments',
                        [ [ 'spaces', ' ' ],
                          [ 'comment', '// another comment' ],
                          [ 'spaces', '\n' ] ] ] ] ] ] ],
              [ 'stmtEnd', [ 'spacesAndComments', [] ] ],
              [ 'spacesAndComments', [] ] ] ] ] ] ],
    [ 'stmtEnd', [ 'spacesAndComments', [] ] ],
    [ 'spacesAndComments', [] ] ] ]
 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Readme

Keywords

none

Package Sidebar

Install

npm i ze-helpers

Weekly Downloads

1

Version

0.0.1

License

none

Last publish

Collaborators

  • vkz