nv-array-subtracted-remove
v1.0.0
Published
nv-array-subtracted-remove ========================== - nv-array-subtracted-remove - similiar to [] -- [] of elixir - for test splice
Downloads
2
Readme
nv-array-subtracted-remove
- nv-array-subtracted-remove
- similiar to [] -- [] of elixir
- for test splice
install
- npm install nv-array-subtracted-remove
usage
example
const {
inplc,
imtbl,
gen_all_matches,
inplc_continuous, // remove-fst
inplc_continuous_all, // remove-all
imtbl_continuous, // remove-fst
imtbl_continuous_all, // remove-all
} = require("nv-array-subtracted-remove");
imtbl : immutable
inplc : inplace //inplc sometimes is slightly faster than imtbl, but NOT always
substract-remove
> imtbl([1, true, 2, false, 3, true] , [true, false])
[ 1, 2, 3, true ]
>
> var a0 = [1, true, 2, false, 3, true]
> var a1 = [true,false]
> inplc(a0,a1)
[ 1, 2, 3, true ]
> a0
[ 1, 2, 3, true ]
>
gen_all_matches
var a0 =[1,'a','b',22,33,'a','b',4,'a','a','b']
var a1 = ['a','b']
var g = gen_all_matches(a0,a1)
> (g.next().value)
[ 1, 3 ]
> (g.next().value)
[ 5, 7 ]
> (g.next().value)
[ 9, 11 ]
substract-remove must-include-continuous
> var a0 =[1,'a','b',22,33,'a','b',4,'a','a','b']
> var a1 = ['a','b']
> inplc_continuous_all(a0,a1)
[ 1, 22, 33, 4, 'a' ]
> a0
[ 1, 22, 33, 4, 'a' ]
>
> var a0 =[1,'a','b',22,33,'a','b',4,'a','a','b']
> var a1 = ['a','b']
> imtbl_continuous_all(a0,a1)
[ 1, 22, 33, 4, 'a' ]
> a0
> [1,'a','b',22,33,'a','b',4,'a','a','b']
API
DFLT_EQ:(a,b)=>a===b;
inplc(a0,a1,eq=DFLT_EQ)
imtbl(a0,a1,eq=DFLT_EQ)
gen_all_matches(a0,a1,eq=DFLT_EQ)
inplc_continuous(a0,a1,eq=DFLT_EQ)
inplc_continuous_all(a0,a1,eq=DFLT_EQ)
imtbl_continuous(a0,a1,eq=DFLT_EQ,push=false/for-test-splice-performance/)
imtbl_continuous_all(a0,a1,eq=DFLT_EQ,push=false)
LICENSE
- ISC