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-cli-env-paramd

v1.0.2

Published

nv-cli-env-paramd ================= - generte a class for fixed-key dict - for test ctx syntax in nvlang

Downloads

2

Readme

nv-cli-env-paramd

  • generte a class for fixed-key dict
  • for test ctx syntax in nvlang

install

  • npm install nv-cli-env-paramd -g

usage

    Usage: nv_cli_env_paramd [options]
    Options:
        -c, --env_cls_name        class name, default EnvParamd
        -t, --tmp_names           temp env prop names
        -d, --data_names          env data names
        -h, --help                usage

example

           # nv_cli_env_paramd -c Env -t u v w -d id ctype dtype encd raw jsval
             

            const _un    = undefined;
            const _nu    = null;
            const _t     = true;
            const _f     = false;
            const _O     = Object;
            const _oseal  = Object.seal;
            const _A     = Array;


            const TMP_KS        = [
              "_u",
              "_v",
              "_w"
            ];
            const DATA_OFFSET    = 5 + TMP_KS.length;
            const DATA_KS       = [
              "id",
              "ctype",
              "dtype",
              "encd",
              "raw",
              "jsval"
            ];
            const TMP_KID       = {
              "_u": 5,
              "_v": 6,
              "_w": 7
            };
            const DATA_KID      = {
              "id": 8,
              "ctype": 9,
              "dtype": 10,
              "encd": 11,
              "raw": 12,
              "jsval": 13
            };


            class Env extends _A {
                constructor() {
                    super();
                    this[0] = _nu;  this[1] = _un;
                    this[2] = 0;    this[3] = 0;    this[4] =0;
                    ////
                    this[5]=_un;
                    this[6]=_un;
                    this[7]=_un;
                    ////
                    this[8]=_un;
                    this[9]=_un;
                    this[10]=_un;
                    this[11]=_un;
                    this[12]=_un;
                    this[13]=_un;
                    ////
                    _oseal(this);
                }
                ////#state
                get state_()    {return(this[0])}
                is_pending()    {this[0]===_nu}
                is_returned()   {this[0]===_t }
                is_throwed()    {this[0]===_f }
                is_settled()    {this[0]!==_nu}
                ////#rslt
                get rslt_()    {return(this[1])}
                rtrn(rslt)        {
                    this[0] = _t;
                    this[1] = rslt;
                }
                thrw(err)         {
                    this[0] = _f;
                    this[1] = err
                }
                get pair_()          {return([this[0],this[1]])}
                ////#cursor
                get i()              {return(this[2])}
                set i(n)             {this[2]=n}
                incr_i(n=1)          {this[2]=this[2]+n}
                decr_i(n=1)          {this[2]=this[2]-n}
                zero_i()             {this[2]=0}
                //
                get j()              {return(this[3])}
                set j(n)             {this[3]=n}
                incr_j(n=1)          {this[3]=this[3]+n}
                decr_j(n=1)          {this[3]=this[3]-n}
                zero_j()             {this[3]=0}
                //
                get k()              {return(this[4])}
                set k(n)             {this[4]=n}
                incr_k(n=1)          {this[4]=this[4]+n}
                decr_k(n=1)          {this[4]=this[4]-n}
                zero_k()             {this[4]=0}
                get cursor_dict_()   {return({i:this[2],j:this[3],k:this[4]})}
                get cursor_ary_()    {return([this[2],this[3],this[4]])}
                ////# tmp lex var
                get _u()     {return(this[5])}
                set _u(v)    {this[5]=v}
                get _v()     {return(this[6])}
                set _v(v)    {this[6]=v}
                get _w()     {return(this[7])}
                set _w(v)    {this[7]=v}
                ////
                get tmp_dict_()     {
                    let d = {}
                    for(let i=0;i<TMP_KS.length;i++) {
                       let key = TMP_KS[i];
                       d[key]  = this[5+i]
                    }
                }
                get tmp_ary_()      {
                    return(this.slice(5,5+TMP_KS.length))
                }
                ////
                get id()     {return(this[8])}
                set id(v)    {this[8]=v}
                get ctype()     {return(this[9])}
                set ctype(v)    {this[9]=v}
                get dtype()     {return(this[10])}
                set dtype(v)    {this[10]=v}
                get encd()     {return(this[11])}
                set encd(v)    {this[11]=v}
                get raw()     {return(this[12])}
                set raw(v)    {this[12]=v}
                get jsval()     {return(this[13])}
                set jsval(v)    {this[13]=v}
                ////
                get data_dict_() {
                    let d = {} 
                    for(let i=0;i<DATA_KS.length;i++) {
                       let key = DATA_KS[i];
                       d[key]  = this[DATA_OFFSET+i] 
                    }
                    return(d)
                }
                get data_ary_() {
                    return(this.slice(DATA_OFFSET))
                }
                data_dict_some(kary) {
                    let d = {}
                    for(let key of kary) {
                       if(DATA_KID.hasOwnProperty(key)) {
                          d[key] = this[key]
                       } else {
                       }
                    }
                    return(d)
                }
                data_dict_some_not(kary) {
                    let d = {}
                    for(let key in DATA_KID) {
                       if(kary.includes(key)) {
                          d[key] = this[key]
                       } else {
                       }
                    }
                    return(d)
                }
                data_ary_some(kary) {
                    let arr = []
                    for(let key of kary) {
                       if(DATA_KID.hasOwnProperty(key)) {
                          arr.push(this[key])
                       } else {
                       }
                    }
                    return(arr)
                }
                data_ary_some_not(kary) {
                    let arr = {}
                    for(let key in DATA_KID) {
                       if(kary.includes(key)) {
                          arr.push(this[key])
                       } else {
                       }
                    }
                    return(arr)
                }
                reset() {
                    this[0]=_nu;
                    this[1]=_un;
                    for(let i=2;i<5;i++)                       {this[i]=0}
                    for(let i=5;i<5+this.length;i++)           {this[i]=_un}
                }
            }

            const creat = (initd={})=>{
                let env = new Env();
                for(let key in initd) {
                  if(DATA_KID.hasOwnProperty(key)) {
                     this[key] = initd[key]
                  } else {}
                }
                return(env)
            }

            module.exports = creat;

METHODS

> env.

//fixed methods
env.reset                 env.rtrn                env.thrw
env.state_                env.rslt_               env.pair_  [true,rslt] | [false,err] | [null,undefined]
env.is_pending
env.is_returned
env.is_throwed
env.is_settled

//three fixed cursor
env.i  env.decr_i                env.incr_i     env.zero_i          
env.j  env.incr_j                env.incr_j     env.zero_j
env.k  env.incr_k                env.decr_k     env.zero_k
env.cursor_ary_           env.cursor_dict_





//temp 
env._u                    env._v                    env._w
env.tmp_ary_              env.tmp_dict_

//data
env.id   env.ctype  env.dtype env.encd env.jsval  env.raw
env.data_ary_             env.data_dict_
env.data_ary_some         env.data_ary_some_not
env.data_dict_some        env.data_dict_some_not

EXAMPLE

        > env
        Env(14) [
          null,      undefined,
          0,         0,
          0,         undefined,
          undefined, undefined,
          undefined, undefined,
          undefined, undefined,
          undefined, undefined
        ]
        > env.id = "000000000"
        '000000000'
        > env.ctype = "br"
        'br'
        > env.dtype = 'dict'
        > env.encd = "jsn"
        'jsn'
        > env.raw = `{"a":100}`
        '{"a":100}'
        > env.jsval = {a:100}
        { a: 100 }
        > env
        Env(14) [
          null,        undefined,
          0,           0,
          0,           undefined,
          undefined,   undefined,
          '000000000', 'br',
          'dict',   'jsn',
          '{"a":100}', { a: 100 }
        ]

        > env.data_dict_
        {
          id: '000000000',
          ctype: 'br',
          dtype: undefined,
          encd: 'kvntree',
          raw: '{"a":100}',
          jsval: { a: 100 }
        }
        > env.data_dict_some(["ctype","jsval"])
        { ctype: 'br', jsval: { a: 100 } }
        >

LICENSE

  • ISC