0.0.4 • Published 3 years ago

cherry-id v0.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

🌸 cherry-id

NPM version jaywcjlove/sb

介绍

核心算法版权属于 yitter

项目更多介绍参照:https://github.com/yitter/IdGenerator

使用

const GenId = require('cherry-id');
const genid = new GenId({ WorkerId: (process.argv[2] || 1) - 0 });

(() => {
  console.time("Test Run");
  const HSet = new Set();
  for (let index = 0; index < 500000; index++) {
    HSet.add(genid.NextId());
  }
  console.timeEnd("Test Run");
  console.log([...HSet.values()].join("\n"))
  console.log(HSet.size);
})();