项目作者: mahabubdev

项目描述 :
Unique ID generator by @mahabubdev
高级语言: JavaScript
项目地址: git://github.com/mahabubdev/myuid.git
创建时间: 2021-03-29T07:28:32Z
项目社区:https://github.com/mahabubdev/myuid

开源协议:

下载


myUID - Simple UID generator

Just install it and use for generating simple uid

Installation

npm install myuid --save

or

yarn add myuid

Then…

  1. const myuid = require('myuid');
  2. myuid(); // returns the generated id

in ES6:

  1. import myuid from 'myuid';
  2. myuid(); // returns the generated id

Options

  1. /*----------------------------------------*
  2. * by default the base number is 16.
  3. * supports only 2->32 as the base number.
  4. *-----------------------------------------*/
  5. myuid(6); // computing with base number 6
  6. myuid(8); // computing with base number 8
  7. myuid(12); // computing with base number 12

How it returns

  1. // in base 16 (by default)
  2. 26893d11f7d624
  3. c8bf02c8a2088
  4. b3b27c18df4a3
  5. // in base 32
  6. ct59nvd0sco
  7. 710cfjcob40
  8. // in base 24
  9. 7bkacdi4dek8
  10. a8h1ida53d98
  11. // in base 6
  12. 155442533105314350430
  13. 222504154304155553310
  14. // in base 8
  15. 222504154304155553310
  16. 222504154304155553310
  17. // in base 12
  18. b114b296405a840
  19. 5a7a2b8a1242b32