https://github.com/chancehudson/random-objectid
Generate a 12 byte hexadecimal string that can act as a mongo ObjectID
https://github.com/chancehudson/random-objectid
Last synced: 3 months ago
JSON representation
Generate a 12 byte hexadecimal string that can act as a mongo ObjectID
- Host: GitHub
- URL: https://github.com/chancehudson/random-objectid
- Owner: chancehudson
- Created: 2019-04-18T04:32:49.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-04-14T20:44:40.000Z (over 6 years ago)
- Last Synced: 2025-03-18T12:55:23.807Z (over 1 year ago)
- Language: JavaScript
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# random-objectid
Returns a Promise that will resolve to a random 12 byte hex string.
## Install
In a project:
```sh
npm install --save-dev random-objectid
```
Globally:
```sh
npm install --global random-objectid
```
## Usage
In code:
```js
const randomObjectId = require('random-objectid')
() => {
const testId = randomObjectId()
console.log('generated random id', testId)
}
```
From CLI:
```sh
$ random-objectid
37bfc2ff43cfc1ef75abe9c3
```
# License
MIT