nv-dict-replace-with-function
- nv-dict-replace-with-function
install
- npm install nv-dict-replace-with-function
usage
example
const {
fst,
fst_not,
lst,
lst_not,
which,
which_not,
which_from_lst,
which_not_from_lst,
some,
some_not,
some_from_lst,
some_not_from_lst,
all,
all_not,
} = require("nv-dict-replace-with-function");
var d = {a:100,b:200,c:300,d:400}
all(d,'XX',(v,k,i)=>v>250 || k==='b')
> d
{ a: 100, b: 'XX', c: 'XX', d: 'XX' }
>
var d = {a:100,b:200,c:100,d:200}
fst(d,'XX',(v,k,i)=>v===100)
>
{ a: 'XX', b: 200, c: 100, d: 200 }
>
var d = {a:100,b:200,c:100,d:200}
lst(d,'XX',(v,k,i)=>v===100)
>
{ a: 100, b: 200, c: 'XX', d: 200 }
>
API
- dict_frplc.fst(d,new_val,cond_func,...cond_other_func_params)
- dict_frplc.fst_not(d,new_val,cond_func,...cond_other_func_params)
- dict_frplc.which(d,new_val,index,cond_func,...cond_other_func_params)
- dict_frplc.which_not(d,new_val,index,cond_func,...cond_other_func_params)
- dict_frplc.which_from_lst(d,new_val,index,cond_func,...cond_other_func_params)
- dict_frplc.which_not_from_lst(d,new_val,index,cond_func,...cond_other_func_params)
- dict_frplc.lst(d,new_val,cond_func,...cond_other_func_params)
- dict_frplc.lst_not(d,new_val,cond_func,...cond_other_func_params)
- dict_frplc.some(d,new_val,whiches,cond_func,...cond_other_func_params)
- dict_frplc.some_not(d,new_val,whiches,cond_func,...cond_other_func_params)
- dict_frplc.some_from_lst(d,new_val,whiches,cond_func,...cond_other_func_params)
- dict_frplc.some_not_from_lst(d,new_val,whiches,cond_func,...cond_other_func_params)
- dict_frplc.all(d,new_val,cond_func,...cond_other_func_params)
- dict_frplc.all_not(d,new_val,cond_func,...cond_other_func_params)
LICENSE