nv-dict-optional

0.0.2 • Public • Published

nv-dict-optional

  • nv-dict-optional

install

  • npm install nv-dict-optional

usage

example

const dict_opt = require("nv-dict-optional")

ordered

var tem = {
    a:'A',
    b:'B',
    c:'C',
    d:'D'
}

var is_optional = {
    b:true,
    d:true
}
var with_placeholder=false;

var g = gen_ordered(tem,is_optional,with_placeholder)

/*
> Array.from(g)
[
  { a: 'A', c: 'C' },
  { a: 'A', c: 'C', d: 'D' },
  { a: 'A', b: 'B', c: 'C' },
  { a: 'A', b: 'B', c: 'C', d: 'D' }
]
>
*/

var with_placeholder = true;
var placeholder = null;
var g = gen_ordered(tem,is_optional,with_placeholder,placeholder)
/*
> Array.from(g)
[
  { a: 'A', b: null, c: 'C', d: null },
  { a: 'A', b: null, c: 'C', d: 'D' },
  { a: 'A', b: 'B', c: 'C', d: null },
  { a: 'A', b: 'B', c: 'C', d: 'D' }
]
>
*/

API

  • dict_opt.gen_ordered(tem,cfg,with_placeholder=false,placeholder=null)
  • dict_opt.ordered(tem,cfg,with_placeholder=false,placeholder=null)

LICENSE

  • ISC

Readme

Keywords

none

Package Sidebar

Install

npm i nv-dict-optional

Weekly Downloads

1

Version

0.0.2

License

ISC

Unpacked Size

2.4 kB

Total Files

3

Last publish

Collaborators

  • ihgazni2