npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

nv-data-tree-csp-jconvert

v1.0.8

Published

nv-data-tree-csp-jconvert ================= - nv-data-tree-csp-jconvert - convert serveral speical json-format(used in nvlang) to a tree

Readme

nv-data-tree-csp-jconvert

  • nv-data-tree-csp-jconvert
  • convert serveral speical json-format(used in nvlang) to a tree

install

  • npm install nv-data-tree-csp-jconvert

usage

sexpr

  • shape S = [tag:String,attrib:Object,child:Array]

const {
    dfs_eng,
    dfs_sexpr,
}  = require("nv-data-tree-csp-jconvert")


//type S [tag:String,attrib:Object,child:Array<S>]

var S0 = [
    'html',{}, [
        [
            'head',{}, [
                 ['meta', {name:'viewport'},[]],
                 ['meta', {},[]]
            ],
        ],
        [
            'body',{}, [
                ['div',{id:"top_nav"},[]],
                ['div',{},[]]
            ]
        ]
    ]
]

var [rt,forest] = dfs_sexpr.tree_lize(S0)

> dfs_sexpr.show(rt)
html
    head
        meta
            -name viewport
        meta
    body
        div
            -id top_nav
        div


> console.dir(dfs_sexpr.jsonize(rt),{depth:null})
[
  'html',
  {},
  [
    [
      'head',
      {},
      [ [ 'meta', { name: 'viewport' }, [] ], [ 'meta', {}, [] ] ]
    ],
    [
      'body',
      {},
      [ [ 'div', { id: 'top_nav' }, [] ], [ 'div', {}, [] ] ]
    ]
  ]
]

tac

  • T@optional : String, if-skipped, it will be a index
  • A@optional : Object
  • C@optional : Array<...S>
  • S : [T?,A?,C?]

valid-ptrn

 [T],[A],[C],
 [T,A],[T,C],[A,C],
 [T,A,C]

const {
    wfs_eng,
    wfs_tac,
}  = require("nv-data-tree-csp-jconvert")


 var TAC0 = [
      'html',[
           'head',[
                 'meta',{charset:"utf8"},
           ],
           'body',{id:"app"},[
                'div',['',{_text:'xxxx'}],
                'br',
                'div',['',{_text:'xxxx'}],
                'br'
           ]
      ]
 ]


 var [rt,forest] = wfs_tac.tree_lize(TAC0);
 wfs_tac.show(rt)
 >
 @root@
    html
        head
            meta
                -charset utf8
        body
            -id app
            div

                    -_text xxxx
            br
            div

                    -_text xxxx
            br

 console.dir(wfs_tac.jsonize(rt),{depth:null});
  
    [
      'html',
      [
        'head',
        [ 'meta', { charset: 'utf8' } ],
        'body',
        { id: 'app' },
        [
          'div',
          [ '', { _text: 'xxxx' } ],
          'br',
          'div',
          [ '', { _text: 'xxxx' } ],
          'br'
        ]
      ]
    ]


     var TAC1 = [
          'html',[
               'head',[
                     'meta',{charset:"utf8"},
               ],
               'body',{id:"app"},[
                    'div',[{_text:'xxxx'}],
                    'br',
                    'div',[{_text:'xxxx'}],
                    'br'
               ]
          ]
     ]
     
     var [rt,forest] = wfs_tac.tree_lize(TAC1);
     console.dir(wfs_tac.jsonize(rt),{depth:null});
     [
       'html',
       [
         'head',
         [ 'meta', { charset: 'utf8' } ],
         'body',
         { id: 'app' },
         [
           'div',
           [ 0, { _text: 'xxxx' } ],
           'br',
           'div',
           [ 0, { _text: 'xxxx' } ],
           'br'
         ]
       ]
     ]

missing T/A/C

    > var [rt,forest] = wfs_tac.tree_lize([{a:100},{b:200}])
    > wfs_tac.show(rt)
    @root@
        0
            -a 100
        1
            -b 200

    > console.dir(wfs_tac.jsonize(rt),{depth:null});
    [ { a: 100 }, { b: 200 } ]


    > var [rt,forest] = wfs_tac.tree_lize(['t0','t1',{a:100},{b:200}])

    > wfs_tac.show(rt)
    @root@
        t0
        t1
            -a 100
        2
            -b 200

    > console.dir(wfs_tac.jsonize(rt),{depth:null});
    [ 't0', 't1', { a: 100 }, { b: 200 } ]


    > var [rt,forest] = wfs_tac.tree_lize(['t0','t1',{a:100},'t2',{b:200}])
    undefined
    > wfs_tac.show(rt)
    @root@
        t0
        t1
            -a 100
        t2
            -b 200
    > console.dir(wfs_tac.jsonize(rt),{depth:null});
    [ 't0', 't1', { a: 100 }, 't2', { b: 200 } ]



    > var [rt,forest] = wfs_tac.tree_lize([[1,2],{a:100}])

    > wfs_tac.show(rt)
    @root@
        0
            1
            2
        1
            -a 100

    > console.dir(wfs_tac.jsonize(rt),{depth:null});
    [ [ 1, 2 ], { a: 100 } ]

cnest

  • E: {[k?]:any,ckey@custom-defined:Array }

wfs

const {
    wfs_eng,
    wfs_tac,
}  = require("nv-data-tree-csp-jconvert")

 var CNEST = 
    {
       tag:'html',
       children: [
          {
              tag:'head',
              children: [
                  { tag:'meta',attribs:{charset:"utf8"}}
              ]
          },
          {
              tag:'body',
              attribs:{id:"app"},
              children: [
                  { tag:'div',children:[{tag:'',attribs:{_text:'xxxx'}}]},
                  { tag:'br'},
                  { tag:'div',children:[{tag:'',attribs:{_text:'xxxx'}}]},
                  { tag:'br'},
              ]
          },
       ]
   }


var [rt,forest] = wfs_cnest.tree_lize(CNEST)
wfs_cnest.show(rt)
>
html
    head
        meta
            -charset utf8
    body
        -id app
        div

                -_text xxxx
        br
        div

                -_text xxxx
        br

 
console.dir(wfs_cnest.jsonize(rt),{depth:null})
{
  tag: 'html',
  children: [
    {
      tag: 'head',
      children: [ { tag: 'meta', attribs: { charset: 'utf8' } } ]
    },
    {
      tag: 'body',
      attribs: { id: 'app' },
      children: [
        {
          tag: 'div',
          children: [ { tag: '', attribs: { _text: 'xxxx' } } ]
        },
        { tag: 'br' },
        {
          tag: 'div',
          children: [ { tag: '', attribs: { _text: 'xxxx' } } ]
        },
        { tag: 'br' }
      ]
    }
  ]
}

dfs

const {
    dfs_cnest,
}  = require("nv-data-tree-csp-jconvert")



 var CNEST = 
    {
       tag:'html',
       children: [
          {
              tag:'head',
              children: [
                  { tag:'meta',attribs:{charset:"utf8"}}
              ]
          },
          {
              tag:'body',
              attribs:{id:"app"},
              children: [
                  { tag:'div',children:[{tag:'',attribs:{_text:'xxxx'}}]},
                  { tag:'br'},
                  { tag:'div',children:[{tag:'',attribs:{_text:'yyyy'}}]},
                  { tag:'br'},
              ]
          },
       ]
   }


var [rt,forest] = dfs_cnest.tree_lize(CNEST)
dfs_cnest.show(rt)
html
    head
        meta
            -charset utf8
    body
        -id app
        div

                -_text xxxx
        br
        div

                -_text xxxx
        br

    console.dir(dfs_cnest.jsonize(rt),{depth:null})
    {
      children: [
        {
          tag: 'html',
          children: [
            {
              tag: 'head',
              children: [
                { tag: 'meta', attribs: { charset: 'utf8' }, children: [] }
              ]
            },
            {
              tag: 'body',
              attribs: { id: 'app' },
              children: [
                {
                  tag: 'div',
                  children: [ { tag: '', attribs: { _text: 'xxxx' }, children: [] } ]
                },
                { tag: 'br', children: [] },
                {
                  tag: 'div',
                  children: [ { tag: '', attribs: { _text: 'yyyy' }, children: [] } ]
                },
                { tag: 'br', children: [] }
              ]
            }
          ]
        }
      ]
    }

array

  • O = {[N:String]:Object}
  • e = [op,Array<String|O>?]
  • E = [op,Array<E|e>]

const {
    dfs_ary
}  = require("nv-data-tree-csp-jconvert"); 


    var ary = [
       {'%program':{target:'js'}},
       ['%let','a'],                             //执行时 %let 也有返回值 {'a':{type:'notation'}}
       ['%let',{'b':{type:'%$i32'}}],
       ['%let','c'],
       ['%+','5','3'],                     //存入当前节点 可以被 %sdfs_prev% 获取
       ['%asgn','a','%sdfs_prev%'],
       ['%-',['%+','5','3']/*存入当前节点*/,['%-','5','3']/*存入当前节点*/] //存入当前节点,
       ['%def','fname',
           ['%params','A','B','C'],             //%params 会在 当前ctx.%params 上 添加 一组 notation
           ['%add','A','B','C'],
           ['%asgn','rslt','%sdfs_prev%'],
           ['%ret%','%rslt%']
       ],
       ['%call','fname',['%args','a','b','c']]
    ]

    var [rt,forest] = dfs_ary.tree_lize(ary)
    dfs_ary.show(rt)

    %program
        -target js
        %let
            a
        %let
            b
                -type %$i32
        %let
            c
        %+
            5
            3
        %asgn
            a
            %sdfs_prev%
        %-
            %+
                5
                3
            %-
                5
                3
        %def
            fname
            %params
                A
                B
                C
            %add
                A
                B
                C
            %asgn
                rslt
                %sdfs_prev%
            %ret%
                %rslt%
        %call
            fname
            %args
                a
                b
                c


    > dfs_ary.jsonize(rt)
    [
      { '%program': { target: 'js' } },
      [ '%let', 'a' ],
      [ '%let', { b: [Object] } ],
      [ '%let', 'c' ],
      [ '%+', '5', '3' ],
      [ '%asgn', 'a', '%sdfs_prev%' ],
      [ '%-', [ '%+', '5', '3' ], [ '%-', '5', '3' ] ],
      [
        '%def',
        'fname',
        [ '%params', 'A', 'B', 'C' ],
        [ '%add', 'A', 'B', 'C' ],
        [ '%asgn', 'rslt', '%sdfs_prev%' ],
        [ '%ret%', '%rslt%' ]
      ],
      [ '%call', 'fname', [ '%args', 'a', 'b', 'c' ] ]
    ]
    >

LICENSE

  • ISC