1.0.4 • Published 3 years ago

nv-cli-param v1.0.4

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

nv-cli-param

  • nv-cli-param
  • cli tool, quickly change param order

install

  • npm install nv-cli-param -g

usage

nv-cli-param# nv_param_parti -h
Usage: nv_param_parti [options]
Options:
    -n, --name            generate partitial function name, optional, default is params.join()
    -f, --function        template function
    -p, --params          selected params
    -r, --rest            spread rest param name, optional
    -o, --output          output js file,default stdout
    -h, --help            usage




nv-cli-param# nv_param_parse -h
Usage: nv_param_parse [options]
Options:
    -f, --function        template function
    -i, --input           input function file,default stdin
    -o, --output          output js file,default stdout
    -h, --help            usage

nv-cli-param#


    Usage: nv_param_pary [options]
    Options:
        -f, --function        template function
        -i, --input           input function file,default stdin
        -o, --output          output js file,default stdout
        -h, --help            usage

partitial

# nv_param_parti -f "function origf(a,b=200,c,d=400,e,...args) {return([a,b,c,d,e])}" -p e a c

function origf$e_a_c(e,a,c){
    return(origf(a,200,c,400,e))
}

#

parse

nv-cli-param# nv_param_parse -f "function func(a,b=200,c,d=400,e,...args) {return([a,b,c,d,e])}"
{
    "fname": "func",
    "params": [
        "a",
        "b",
        "c",
        "d",
        "e"
    ],
    "defaults": {
        "b": "200",
        "d": "400"
    },
    "lst": "args",
    "is_last_rest": true,
    "required_num": 3,
    "total_param_num": "<Infinity>",
    "body": "{\n  return [a, b, c, d, e];\n}"
}
nv-cli-param#

pary

 #nv\_param\_pary -f "function tst(a,b,c,d=300,e,...args){}"
 
 [ 'a', 'b', 'c', { d: '300' }, 'e', [ 'args' ] ]

LICENSE

  • ISC