react-native-uuid
Version:
react-native-uuid is a zero-dependency TypeScript implementation of RFC4122.
70 lines (44 loc) • 4.17 kB
Markdown
# react-native-uuid
[](./LICENSE)
[](https://www.npmjs.com/package/react-native-uuid)
[](https://npmcharts.com/compare/react-native-uuid?minimal=true)
[](https://npmcharts.com/compare/react-native-uuid?minimal=true)
[](https://github.com/eugenehp/react-native-uuid/watchers)
[](https://github.com/eugenehp/react-native-uuid/stargazers)
[](https://github.com/eugenehp/react-native-uuid/network/members)
[](https://github.com/eugenehp/react-native-uuid/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+label%3Abug)
[](https://github.com/eugenehp/react-native-uuid/issues)
[](https://github.com/eugenehp/react-native-uuid/pulls)
[](https://packagephobia.com/result?p=react-native-uuid)
[](https://bundlephobia.com/result?p=react-native-uuid@2.0.0)
`react-native-uuid` is a zero-dependency TypeScript implementation of [RFC4122](https://tools.ietf.org/html/rfc4122) standard **A Universally Unique IDentifier (UUID) URN Namespace**. Please note, this library uses pseudo random generator based on top of `Math.random`. New version with hardware support is WIP.
**Heavily inspired by:**
- [uuid](https://github.com/uuidjs/uuid)
- [pure-uuid](https://github.com/rse/pure-uuid)
- [nanoid](https://www.npmjs.com/package/nanoid)
Huge thanks to [Randy Coulman](https://github.com/randycoulman) for the early version of a code.
## Getting started
Use this steps to install and create UUIDs. Example projec is available [here](https://github.com/eugenehp/RNUUID)
### 1. Install
```shell
npm install react-native-uuid
```
### 2. Create a UUID
```javascript
import uuid from 'react-native-uuid';
uuid.v4(); // ⇨ '11edc52b-2918-4d71-9058-f7285e29d894'
```
## Documentation
Methods documentation is available [here](./docs/modules.md)
## Troubleshooting
Previous version has been based on `randombytes` that is not compatible with react-native out of the box.
Please submit an [issue](https://github.com/eugenehp/react-native-uuid/issues) if you found a bug.
## react-native-uuid for enterprise
Available as part of the Tidelift Subscription.
The maintainers of react-native-uuid and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source packages you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact packages you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-react-native-uuid?utm_source=npm-react-native-uuid&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
## Sponsorship
Thank you to our sponsors:
[<img width="300px" src="https://user-images.githubusercontent.com/1857263/114124204-c4e1eb80-98a8-11eb-80ab-64683c24bbc5.png" alt="Reactive Lions™" target="_blank">](https://www.reactivelions.com)
## License
[MIT](./LICENSE)
Copyright (c) 2016-2021 Eugene Hauptmann