You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 751 B

4 years ago
1234567891011121314151617181920212223242526
  1. <!--
  2. * @description: README
  3. * @author: bubao
  4. * @date: 2021-04-28 09:52:24
  5. * @last author: bubao
  6. * @last edit time: 2021-04-28 10:34:31
  7. -->
  8. # cherry-id
  9. [![NPM version](https://img.shields.io/npm/v/cherry-id.svg)](https://www.npmjs.com/package/cherry-id) [![jaywcjlove/sb](https://jaywcjlove.github.io/sb/lang/english.svg)](README.md)
  10. 该代码参考 go 版本,需要 Nodejs 或者浏览器支持 `BigInt`。基本参数与 go 版本一致,只要,但是只实现了雪花飘移算法,没有传统的雪花算法,所以`Method`参数并没有作用。
  11. ## 使用
  12. ```js
  13. const GenId = require("./index.js")
  14. const genid = new GenId({ WorkerId: 1 });
  15. for (let index = 0; index < 5000; index++) {
  16. console.log(genid.NextId());
  17. }
  18. ```