1.0.1 • Published 3 years ago

nv-facutil-param v1.0.1

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

nv-facutil-param

  • nv-facutil-param
  • util for handle function params
  • its a simplified-version of nv-facutil-curry, manually,NOT auto,no need to parse

install

  • npm install nv-facutil-param

usage

example

const fac_param = require("nv-facutil-param");


function src_func(k,...os) {
    console.log(k,...os)
}

/*
    function target_func(v,k,i,...os) {

    }
*/

var src_params_desc = ['k','...os']
var target_params_desc = ['v','k','i','...os']
var descs = creat_params_desc(src_params_desc,target_params_desc)
> [ v [empty] {}, k [normal] {}, i [empty] {}, ...os [rest] {} ]
> descs[2].json()
{ name: 'i', type: 'empty', dflt: undefined }
> descs[3].json()
{ name: 'os', type: 'rest', dflt: undefined }
>

METHODS

desc.dflt
desc.unset_dflt                  
desc.json
desc.name 
desc.type                             
desc.slct_normal
desc.slct_empty
desc.slct_rest                               

API

  • fac_param.creat_params_desc(src_params_desc,target_params_desc)

LICENSE

  • ISC