1.0.4 • Published 4 years ago

nvdtb v1.0.4

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

nvdtb

  • nvdtb is a simple util for small-table ,such as config or init some const

install

  • npm install nvdtb

usage

###cvc

const nvdtb = require(nvdtb);
const Dtb = nvdtb.Cudtb


var dtb = new Dtb(4,'state','anti_state','key','anti_key')
dtb.state = ['undefined','pending','resolved','rejected']
dtb.anti_state = ['undefined','pending','rejeted','resolved']
dtb.key = ['undefined','pending','rslt','exception']
dtb.anti_key = ['undefined','pending','exception','rslt']


> dtb
    state | anti_state |       key |  anti_key
----------------------------------------------
undefined |  undefined | undefined | undefined
----------------------------------------------
  pending |    pending |   pending |   pending
----------------------------------------------
 resolved |    rejeted |      rslt | exception
----------------------------------------------
 rejected |   resolved | exception |      rslt
----------------------------------------------


> dtb.cvc('state','resolved','anti_key')
'exception'

###sort

const Dtb = require("./index").Cudtb
var dtb = new Dtb(3,'name','class','year')
dtb.name = ['john','jane','dave']
dtb.class = ['A','B','B']
dtb.year = [15,12,10]

> dtb
name | class | year
-------------------
john |     A |   15
-------------------
jane |     B |   12
-------------------
dave |     B |   10
-------------------
>

dtb.sort()                 default use the compare sequence of inited: ['name','class','year']
> dtb                  
name | class | year
-------------------
dave |     B |   10
-------------------
jane |     B |   12
-------------------
john |     A |   15
-------------------
>


dtb.sort(["year","class","name"])

> dtb
name | class | year
-------------------
dave |     B |   10
-------------------
jane |     B |   12
-------------------
john |     A |   15
-------------------
>

APIS

{
  cmmn: {
    kvl_to_entries: [Function: kvl_to_entries],
    entries_to_kvl: [Function: entries_to_kvl],
    kvl_to_dict: [Function: kvl_to_dict],
    dict_to_kvl: [Function: dict_to_kvl],
    entries_to_dict: [Function: entries_to_dict],
    dict_to_entries: [Function: dict_to_entries],
    is_list_unique: [Function: is_list_unique],
    prepend_str: [Function: prepend_str]
  },
  basic: {
    init_row: [Function: init_row],
    init_dtb: [Function: init_dtb],
    dtb_to_cols: [Function: dtb_to_cols],
    cols_to_dtb: [Function: cols_to_dtb],
    dtb_to_mat: [Function: dtb_to_mat],
    dtb_to_tmat: [Function: dtb_to_tmat],
    unzip: [Function: unzip],
    zip: [Function: zip],
    transform: [Function: transform],
    creat_row: [Function: creat_row],
    get_cnl: [Function: get_cnl],
    get_colnum: [Function: get_colnum],
    get_cnl_from_dtb: [Function: get_cnl_from_dtb],
    get_cnl_from_cols: [Function: get_cnl_from_cols],
    get_row: [Function: get_row],
    get_col: [Function: get_col],
    get_val: [Function: get_val],
    get_cvl: [Function: get_cvl],
    get_rvl: [Function: get_rvl],
    set_row: [Function: set_row],
    prepend_row: [Function: prepend_row],
    insert_row: [Function: insert_row],
    append_row: [Function: append_row],
    del_row: [Function: del_row],
    set_col: [Function: set_col],
    prepend_col: [Function: prepend_col],
    insert_col: [Function: insert_col],
    append_col: [Function: append_col],
    del_col: [Function: del_col]
  },
  unicol: {
    is_cvl_unique: [Function: is_cvl_unique],
    is_col_unique: [Function: is_col_unique],
    'is_dtb_col$unique': [Function: is_dtb_col$unique],
    get_rn_with_cvl: [Function: get_rn_with_cvl],
    get_rn_with_col: [Function: get_rn_with_col],
    cvc: [Function: cvc],
    Dtb: [Function: Dtb]
  },
  Cudtb: [Function: Dtb]
}

RESTRICT

LICENSE

  • ISC