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

39 lines
1.5 KiB

2 years ago
  1. # Nano ID
  2. <img src="https://ai.github.io/nanoid/logo.svg" align="right"
  3. alt="Nano ID logo by Anton Lovchikov" width="180" height="94">
  4. **English** | [Русский](./README.ru.md) | [简体中文](./README.zh-CN.md) | [Bahasa Indonesia](./README.id-ID.md)
  5. A tiny, secure, URL-friendly, unique string ID generator for JavaScript.
  6. > “An amazing level of senseless perfectionism,
  7. > which is simply impossible not to respect.”
  8. * **Small.** 130 bytes (minified and gzipped). No dependencies.
  9. [Size Limit] controls the size.
  10. * **Fast.** It is 2 times faster than UUID.
  11. * **Safe.** It uses hardware random generator. Can be used in clusters.
  12. * **Short IDs.** It uses a larger alphabet than UUID (`A-Za-z0-9_-`).
  13. So ID size was reduced from 36 to 21 symbols.
  14. * **Portable.** Nano ID was ported
  15. to [20 programming languages](#other-programming-languages).
  16. ```js
  17. import { nanoid } from 'nanoid'
  18. model.id = nanoid() //=> "V1StGXR8_Z5jdHi6B-myT"
  19. ```
  20. Supports modern browsers, IE [with Babel], Node.js and React Native.
  21. [online tool]: https://gitpod.io/#https://github.com/ai/nanoid/
  22. [with Babel]: https://developer.epages.com/blog/coding/how-to-transpile-node-modules-with-babel-and-webpack-in-a-monorepo/
  23. [Size Limit]: https://github.com/ai/size-limit
  24. <a href="https://evilmartians.com/?utm_source=nanoid">
  25. <img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg"
  26. alt="Sponsored by Evil Martians" width="236" height="54">
  27. </a>
  28. ## Docs
  29. Read **[full docs](https://github.com/ai/nanoid#readme)** on GitHub.