nv-facutil-simple-pairid
v1.0.3
Published
nv-facutil-simple-pairid ======================= - simple util to create a enum-like class - simple util for +1 AND -1
Downloads
2
Readme
nv-facutil-simple-pairid
- simple util to create a enum-like class
- simple util for +1 AND -1
install
- npm install nv-facutil-simple-pairid
usage
const {creat,glb_sid,glb_bid} = require("nv-facutil-simple-pairid");
var next = creat(5);
next()
example
safe int
> var next = creat(5)
> next()
[ 1, 11 ]
> next()
[ 2, 10 ]
> next()
[ 3, 9 ]
> next()
[ 4, 8 ]
> next()
[ 5, 7 ]
> next()
[ 1, 11 ]
> next()
[ 2, 10 ]
> next()
[ 3, 9 ]
> next()
[ 4, 8 ]
> next()
[ 5, 7 ]
> next()
[ 1, 11 ]
>
....
bigint
> var next = creat(2n**55n-1n,1n)
> next()
[ 1n, 72057594037927935n ]
> next()
[ 2n, 72057594037927934n ]
> next()
[ 3n, 72057594037927933n ]
> next()
[ 4n, 72057594037927932n ]
> next()
[ 5n, 72057594037927931n ]
> next()
[ 6n, 72057594037927930n ]
> next()
[ 7n, 72057594037927929n ]
> next()
[ 8n, 72057594037927928n ]
> ....
global
> const ID = require("nv-facutil-simple-pairid");
> ID.SID_
0
> ID.BID_
0n
> ID.glb_sid()
[ 1, 9007199254740991 ]
>
> ID.glb_sid()
[ 2, 9007199254740990 ]
> ID.glb_sid()
[ 3, 9007199254740989 ]
> ID.SID_
3
>
> ID.glb_bid()
[ 1n, 18446744073709551615n ]
> ID.glb_bid()
[ 2n, 18446744073709551614n ]
> ID.glb_bid()
[ 3n, 18446744073709551613n ]
> ID.glb_bid()
[ 4n, 18446744073709551612n ]
> ID.glb_bid()
[ 5n, 18446744073709551611n ]
>
> ID.BID_
5n
>
METHODS
APIS
- creat(maxid,one=1);
- glb_sid();
- glb_bid();
getter
.SID_
.BID_
LICENSE
- ISC