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 🙏

© 2024 – Pkg Stats / Ryan Hefner

nv-top-down-group-tree

v1.0.7

Published

nv-top-down-group-tree ======================= - simple 4\-tuple tree - to test syntax-based-eval-authorization in nvlang, normally USELESS

Downloads

8

Readme

nv-top-down-group-tree

  • simple 4-tuple tree
  • to test syntax-based-eval-authorization in nvlang, normally USELESS

install

  • npm install nv-top-down-group-tree

usage

  const {creat,load_from_json }   = require("nv-top-down-group-tree");

example

        var rt = creat(100000/*max supported node count*/)


        // .creat_group(path, data:Object)
        //  path must begin with "/"
        //  path-tail must match  <<ele>/>+
        //  ele must match ^[_a-z][_a-z0-9]+$

        var [cond,lstnd,grpnds] = rt.creat_group("/a/b/c/d/",{xx:123,yy:456})

        /*

        > grpnds
        [
          [
            '/a/',
            Node(3) [2 %dlgaelfz:2% ] [ [Forest], 2, false, data: [Object] ]
          ],
          [
            '/a/b/',
            Node(3) [3 %dlgaelfz:3% ] [ [Forest], 3, false, data: [Object] ]
          ],
          [
            '/a/b/c/',
            Node(3) [4 %dlgaelfz:4% ] [ [Forest], 4, false, data: [Object] ]
          ],
          [
            '/a/b/c/d/',
            Node(3) [5 %dlgaelfz:5% ] [ [Forest], 5, false, data: [Object] ]
          ]
        ]
        >


        > lstnd.path_
        '/a/b/c/d/'
        >
        lstnd.tag_
        'd'
        lstnd.data
        {xx:123,yy:456}

        */

        var [cond,nd] = rt.pget("/a")
        /*
        > rt.pget("/a")
        [
          true,
          Node(3) [2 %dlgaelfz:2% ] [
            Forest {
              fid: 'dlgaelfzcbgbwhewjmocuymjfxqdghiisehu',
              max_size: 100000,
              idpool: [Object]
            },
            2,
            false,
            data: { xx: 123, yy: 456 }
          ]
        ]
        >
        */


        var [cond,deleted] = rt.dele_group("/a",(data)=>[data.xx===123,"ok"])

        /*
        > deleted
        [
          [ '/a/b/c/d/', { xx: 123, yy: 456 } ],
          [ '/a/b/c/', { xx: 123, yy: 456 } ],
          [ '/a/b/', { xx: 123, yy: 456 } ],
          [ '/a/', { xx: 123, yy: 456 } ]
        ]
        >

        */

        var [cond,lstnd,grpnds] = rt.creat_group("/a/b/c/d/",{xx:123,yy:456})
        var [cond,lstnd,grpnds] = rt.creat_group("/a/b/c/d/e/",{xx:123,yy:789})

        /*
        > lstnd.tag_
        'e'
        > lstnd.path_
        '/a/b/c/d/e/'
        >
        */


        var [cond,r] = rt.join_group('/a/b/c/d/e/','session0',{uname:'abc'});

        /*
        > cond
        true
        > r
        Node(3) [11 %fmhyqada:11% ] [
          Forest {
            fid: 'fmhyqadaxcxcdizfgpdfahrrigynebgrjtdr',
            max_size: 100000,
            idpool: { minid_: 1, maxid_: 100000, used_: 7, lefted_: 99993 }
          },
          11,
          false,
          data: { uname: 'abc' }
        ]
        > r.tag_
        'session0'
        > r.is_leaf()
        true
        >
        > r.$parent_.get_child_with_tag("session0") === r
        true
        >
        */

        var [cond,r] = rt.join_group('/a/b/c/d/e/','session1',{uname:'def'});
        var [cond,r] = rt.join_group('/a/b/c/','session2',{uname:'ghi'});


        var [cond,groupe] = rt.pget("/a/b/c/d/e/")
        var [cond,groupc] = rt.pget("/a/b/c/")


        groupe.ch_paths_
        /*
        >
        [ '/a/b/c/d/e/session0', '/a/b/c/d/e/session1' ]
        */
        groupc.ch_paths_
        groupc.des_paths_
        /*
        > groupc.ch_paths_
        [ '/a/b/c/session2' ]
        >
        > groupc.des_paths_
        [
          '/a/b/c/d/e/session0',
          '/a/b/c/d/e/session1',
          '/a/b/c/session2'
        ]
        >
        */


        var [cond,sess0] = rt.pget("/a/b/c/d/e/session0");

        /*
        > sess0.ppath_
        '/a/b/c/d/e/'
        > sess0.path_
        '/a/b/c/d/e/session0'
        */

        var [cond,r] = rt.leave_group('/a/b/c/d/e/',"session0")
        /*
         > r
        [ 'session0', { uname: 'abc' } ]
        >
        > groupc.ch_paths_
        [ '/a/b/c/session2' ]
        >
        > groupc.des_paths_
        [ '/a/b/c/d/e/session1', '/a/b/c/session2' ]
        >
        > groupe.des_paths_
        [ '/a/b/c/d/e/session1' ]
        > groupe.ch_paths_
        [ '/a/b/c/d/e/session1' ]
        >
        */


        var j = rt.dump2j();  // ttac format:  [ <tag>,<type>,<data>, [Array<ttac>]]
        /*
            [
              [
                'a',2,{ xx: 123, yy: 456 },[
                  [
                    'b',2,{ xx: 123, yy: 456 },[
                      [
                        'c', 2,{ xx: 123, yy: 456 },[
                          [
                            'd',2,{ xx: 123, yy: 456 },[
                              [
                                'e',2,{ xx: 123, yy: 789 },[ 
                                    [ 'session1', 1, { uname: 'def' }, [] ] 
                                ]
                              ]
                            ]
                          ],
                          [ 'session2', 1, { uname: 'ghi' }, [] ]
                        ]
                      ]
                    ]
                  ]
                ]
              ]
            ]
        */


        var rt2 = load_from_json(j)


        /*
        > rt.des_paths_
        [ '/a/b/c/d/e/session1', '/a/b/c/session2' ]
        >
        */
        var rt2 = load_from_json(j)

        /*
        > rt2.des_paths_
        [ '/a/b/c/d/e/session1', '/a/b/c/session2' ]
        >
        */

METHODS

    rt.ch_paths_                               rt.des_paths_                              rt.get_child_with_tag                      rt.is_leaf
    rt.is_nonleaf                              rt.is_rt                                   rt.path_                                   rt.ppath_
    rt.set_as_leaf                             rt.set_as_nonleaf                          rt.set_as_rt                               rt.set_tag
    rt.tag_

    rt.creat_group                             rt.dele_group                              rt.dump2j
    rt.join_group                              rt.leave_group                             rt.pget

    rt.data    

APIS

LICENSE

  • ISC