1.0.1 • Published 3 years ago

nv-dict-assign v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

nv-dict-assign

  • nv-dict-assign
  • the original is ambigious

install

  • npm install nv-dict-assign

usage

add

add(d0,d1):
    for k in d1, do:
        if d0.hasOwnProperty(k):
            pass
        else:
            d0[k] = undefined

set

     set(d0,d1):   
         for k in d1, do:
             if d0.hasOwnProperty(k):
                 d0[k] = d1[k]
             else:
                 pass

add_then_set_if_noexist

add_then_set_if_noexist:
    for k in d1, do:
        if d0.hasOwnProperty(k):
            pass
        else:
            d0[k] = d1[k]

set_if_exist_else_add_then_set

set_if_exist_else_add_then_set:
    for k in d1, do:
        d0[k] = d1[k]

assign

  • same as set_if_exist_else_add_then_set

set_if_exist_else_add

set_if_exist_else_add:
    for k in d1, do:
        if d0.hasOwnProperty(k):
            d0[k] = d1[k]
        else:
            d0[k] = undefined

example

const dict_assign = require("nv-dict-assign")

API

  • add(d0,d1)
  • set(d0,d1)
  • add_then_set_if_noexist(d0,d1)
  • set_if_exist_else_add_then_set(d0,d1)
  • assign(d0,d1)
  • set_if_exist_else_add(d0,d1)
  • del_if_exist(d0,d1)
  • del_if_exist_else_add(d0,d1)
  • del_if_exist_else_add_then_set(d0,d1)

LICENSE

  • ISC