nv-cli-tuple-ject
v1.0.13
Published
nv-cli-tuple-ject =============== - nv-cli-tuple-ject - cli tool, generate a special-class extends of Array - suitable for Node definition - its a simple version of nv-cli-abject, remove the using-of #priv
Downloads
3
Readme
nv-cli-tuple-ject
- nv-cli-tuple-ject
- cli tool, generate a special-class extends of Array
- suitable for Node definition
- its a simple version of nv-cli-abject, remove the using-of #priv
install
- npm install nv-cli-tuple-ject -g
usage
Usage: nv_tuject [options]
Options:
-c, --clsname clsname
-p, --props property desciptions
-f, --format_help the suffix format help
-h, --help usage
suffix AND simple-syntax
nv-cli-tuple-ject# nv_tuject -f
PROP FORMAT
-----------
<name>@<suffix> .....
<name>@gt
<name>@st
<name>@gtst
<name>@radio opt0 opt1 opt2 .....
<name>@method param_name0 param_name1 param_name2 ....
opt only support string|number|null|undefined|true|false
SUFFIX
-------
@radio : means radio selection
@gt : means getter
@st : means setter
@gtst : means getter AND setter
@method: means a method-to-impl
EXAMPLE
-------
nv_tuject
-c Operator\
-p precedence@gtst\
asso@radio left right\
raw@gtst\
type@radio prefix infix suffix\
stringify@method color \
is_unop@method\
is_binop@method\
example
nv_tuject -c Operator -p precedence@gtst asso@radio left right raw@gtst type@radio prefix infix suffix stringify@method color is_unop@method is_binop@method
output
class Operator extends Array {
constructor(precedence,asso,raw,type) {
super();
super.push(
precedence,asso,raw,type
);
}
////
get precedence() {return(this[0])}
set precedence(v) {this[0]=v}
get asso() {return(this[1])}
slct_left_for_asso() {return(this[1]="left")}
slct_right_for_asso() {return(this[1]="right")}
get raw() {return(this[2])}
set raw(v) {this[2]=v}
get type() {return(this[3])}
slct_prefix_for_type() {return(this[3]="prefix")}
slct_infix_for_type() {return(this[3]="infix")}
slct_suffix_for_type() {return(this[3]="suffix")}
stringify(color) {/*impl*/}
is_unop() {/*impl*/}
is_binop() {/*impl*/}
////
}
copy AND paste it
var op = new Operator()
> op.raw ='+'
'+'
> op.slct_infix_for_type()
'infix'
> op.slct_left_for_asso()
'left'
> op.precedence =12
12
> op
Operator(4) [ 12, 'left', '+', 'infix' ]
>
LICENSE
- ISC