1.0.2 • Published 2 years ago
nv-cli-fctx v1.0.2
nv-cli-fctx
- nv-cli-fctx
- simple cli tool, creat some templates for single-param-only style programming
- PARAMD: creat param-dict-ctx
- PRE_CHECK: check input-paramd-ctx
- HANDLE:
- TRANS: transform to output-rtrn-ctx
- POST_CHECK check output-rtrn-ctx
install
- npm install nv-cli-fctx -g
usage
Usage: nv_cli_fctx [options]
Options:
-p, --params ctx param names
-f, --funcname function name,defult="func"
-h, --help usage
example
nv-cli-fctx# nv_cli_fctx -f myfunc -p a b c
function myfunc(ctx) {
myfunc.CHECK_INPUT(ctx);
//<body>
let {a,b,c} = ctx;
/*
impl
*/
//</body>
let nctx = myfunc.TRANS(ctx);
myfunc.CHECK_OUTPUT(nctx);
return(nctx)
}
myfunc.PARAMD = ()=>(
{
"a": null,
"b": null,
"c": null
}
);
myfunc.CHECK_INPUT = (ctx) => {
/*impl checker*/
let cond = /*Boolean*/
if(cond) {
} else {
throw(new Error(/*input-check-fail*/))
}
}
myfunc.TRANS = (ctx) => {
let nctx;
nctx = /*impl*/;
return(nctx)
}
myfunc.CHECK_OUTPUT = (ctx) => {
/*impl checker*/
let cond = /*Boolean*/
if(cond) {
} else {
throw(new Error(/*output-check-fail*/))
}
}
LICENSE
- ISC
1.0.2
2 years ago