# nv-cli-env-paramd

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

Latest version **1.0.2** (published 2022-11-29) · ISC license · 0 weekly downloads

## Install

```sh
npm install nv-cli-env-paramd
pnpm add nv-cli-env-paramd
yarn add nv-cli-env-paramd
bun add nv-cli-env-paramd
```

Provides the command `nv_cli_env_paramd`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2022-11-29 |
| First published | 2022-11-29 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 23.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | ihgazni2 |

## Links

- npm: https://www.npmjs.com/package/nv-cli-env-paramd
- npm.io page: https://npm.io/package/nv-cli-env-paramd

## Dependencies (1)

- [nv-cli-basic](https://npm.io/package/nv-cli-basic.md) ^1.0.11

## Recent versions

- 1.0.2 (latest) — 2022-11-29

## 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

---
_Source: https://npm.io/package/nv-cli-env-paramd · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
