nv-cli-jtype
v1.0.2
Published
nv-cli-jtype ========== - cli tool - to generate a type-description for a valid json, (simliar to what you do in TS interface, but very simple, only fixed-type , not support union...)
Downloads
3
Readme
nv-cli-jtype
- cli tool
- to generate a type-description for a valid json, (simliar to what you do in TS interface, but very simple, only fixed-type , not support union...)
install
- npm install nv-cli-jtype -g
usage
Usage: nv_cli_jtype [options]
Options:
-b, --brief_output_mode enable breif output: S:string N:number B:boolean n:any-json ; default false
-j, --js_output_mode enable js output: string number boolean json; default false
-p, --pg_output_mode enable js output: text:string float8:number bool:blloean json:any-json ; default true
-i, --input input string ,default stdin
-o, --output output string,default stdout
-h, --help usage
example
for js
#nv_cli_jtype -j
// your input
{
k: [
1,
{
a: "",
b: true
},
null
]
}
//press ctrl+D
{
"k": [
"Number",
{
"a": "String",
"b": "Boolean"
},
"JSON"
]
}
for pg, this is default mode
#nv_cli_jtype -p
// your input
{
k: [
1,
{
a: "",
b: true
},
null
]
}
//press ctrl+D
{
"k": [
"float8",
{
"a": "text",
"b": "bool"
},
"json"
]
}
brief mode is for nvlang-repl, normally USELESS, there is another binary-mode(which is used by nvlang-runtime,but it is unreadable: encoded in 4-bit-format ),so the api is not exposed
#nv_cli_jtype -b
// your input
{
k: [
1,
{
a: "",
b: true
},
null
]
}
//press ctrl+D
{
"k": [
"N",
{
"a": "S",
"b": "B"
},
"n"
]
}
LICENSE
- ISC