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 618 B

4 years ago
123456789101112131415161718192021222324252627282930313233
  1. # ❄ idgenerator-TypeScript
  2. ## 介绍
  3. 项目更多介绍参照:https://github.com/yitter/idgenerator
  4. 代码贡献者:zhupengfei(在 bubao 布宝 的JS基础上改版,感谢bubao 布宝)
  5. 执行测试代码
  6. ```bash
  7. ts-node test/test.ts
  8. ```
  9. ## 使用
  10. ```js
  11. import { snowflakeIdv1 } from '../snowflakeIdv1'
  12. const WorkerId = process.env.WorkerId == undefined ? 1 : process.env.WorkerId
  13. const Method = process.env.Method == undefined ? 1 : process.env.Method
  14. let gen1 = new snowflakeIdv1({ WorkerId: WorkerId, Method: Method })
  15. let id1 = gen1.NextId()
  16. console.log(id1, id1.toString().length)
  17. ```