test2.ts 640 字节
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
import { snowflakeIdv1 } from '../snowflakeIdv1'

const WorkerId = process.env.WorkerId == undefined ? 1 : process.env.WorkerId

const Method = process.env.Method == undefined ? 1 : process.env.Method


console.log("WorkerId:" + WorkerId)
console.log("Method:" + Method)
console.log("--------------------")
let gen1 = new snowflakeIdv1({ WorkerId: WorkerId, Method: Method })



function test1() {
    let id1 = gen1.NextId()
    console.log(id1, id1.toString().length)
}

function test2() {
    let id1 = gen1.NextId()
    console.log(typeof (id1))
    console.log(id1, id1.toString().length)
}

function main() {
    test2()
}
main()