nv-facutil-mkject
v1.0.1
Published
nv-facutil-mkject =============== - simple-util for multikey Object, useful for config language conversion - simplified version of nv-facutil-multi-key
Downloads
2
Readme
nv-facutil-mkject
- simple-util for multikey Object, useful for config language conversion
- simplified version of nv-facutil-multi-key
install
- npm install nv-facutil-mkject
usage
example
const {creat_cls,creat_mko} = require("nv-facutil-mkject");
var mko = creat_mko(entries,cnl)
var entries = [
['aa','AA','aA','Aa','a_a','A_A'], 111,
['bb','BB','bB','Bb','b_b','B_B'], 222,
['cc','CC','cC','Cc','c_c','C_C'], 333,
]
var cnl = ['c0','c1','c2','c3','c4','c5']
> mko.cnl_
[ 'c0', 'c1', 'c2', 'c3', 'c4', 'c5' ]
> mko.entries_
[
[ 'aa', 'AA', 'aA', 'Aa', 'a_a', 'A_A' ],
111,
[ 'bb', 'BB', 'bB', 'Bb', 'b_b', 'B_B' ],
222,
[ 'cc', 'CC', 'cC', 'Cc', 'c_c', 'C_C' ],
333
]
> mko.jsones_
{
c0: { aa: 111, bb: 222, cc: 333 },
c1: { AA: 111, BB: 222, CC: 333 },
c2: { aA: 111, bB: 222, cC: 333 },
c3: { Aa: 111, Bb: 222, Cc: 333 },
c4: { a_a: 111, b_b: 222, c_c: 333 },
c5: { A_A: 111, B_B: 222, C_C: 333 }
}
> mko.AA
111
> mko.Aa
111
> mko.aa
111
> mko.json('c2')
{ aA: 111, bB: 222, cC: 333 }
>
> mko.json('c1')
{ AA: 111, BB: 222, CC: 333 }
>
> mko.json('c0')
{ aa: 111, bb: 222, cc: 333 }
>
var Cls = creat_cls(entries,cnl)
var mko = new Cls()
LICENSE
- ISC