Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

自荐项目: Simple-Unique 完全随机生成唯一字符串 #2190

Open
Lete114 opened this issue May 3, 2022 · 0 comments
Open

自荐项目: Simple-Unique 完全随机生成唯一字符串 #2190

Lete114 opened this issue May 3, 2022 · 0 comments

Comments

@Lete114
Copy link

Lete114 commented May 3, 2022

项目推荐

  • 项目地址:Lete114/Simple-Unique

  • 类别:JavaScript

  • 项目后续更新计划:

  • 项目描述:

    • 必写:用于生成随机唯一字符串 ID
  • 推荐理由:对于小项目来说,体积特别小(180~ Byte),对于大型项目来说,速度非常快🚀,它和HelloGitHub73期nanoid类似,但是效率是nanoid的7倍,生成1千万个不重复的唯一ID,Simple-Unique只需约4秒,而nanoid则需要约27秒

  • 示例代码:

const unique = require('simple-unique')
const arr1 = [unique(), unique()]
const arr2 = [unique(20), unique(20)]

console.log(arr1[0] === arr1[1], arr1) // false [ 'krntrfokkp', '35tftcm3tr' ]
console.log(arr2[0] === arr2[1], arr2) // false [ 'lva8timtvipgbenfjkhj', '9s32qj2chqulqxox7npq' ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants