Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tornqvist/jazzon-uuid
Plugin for jazzon to generate a UUID
https://github.com/tornqvist/jazzon-uuid
Last synced: about 1 month ago
JSON representation
Plugin for jazzon to generate a UUID
- Host: GitHub
- URL: https://github.com/tornqvist/jazzon-uuid
- Owner: tornqvist
- Created: 2015-09-21T12:38:31.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-09-24T08:42:19.000Z (over 9 years ago)
- Last Synced: 2024-11-16T08:06:42.067Z (about 1 month ago)
- Language: JavaScript
- Size: 121 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# jazzon-uuid
A plugin for the [jazzon utility](https://www.npmjs.com/package/jazzon) for generate a UUID in place.
## Usage
Supply the plugin to the `jazzon.use` method just like any other plugin.
```javascript
let jazzon = require('jazzon');
let uuid = require('jazzon-uuid');
let json = {
id: "@{ uuid }"
};jazzon
.use(uuid())
.compile(json)
.then((result) {
console.log(result); // => {"id": "6c84fb90-12c4-11e1-840d-7b25c5ee775a"}
});
```## Options
Options can be supplied to the plugin to alter its' output. All options but the `version` key is forwarded to [uuid](https://github.com/defunctzombie/node-uuid).
```javascript
jazzon.use(uuid({
node: [0x01, 0x23, 0x45, 0x67, 0x89, 0xab],
clockseq: 0x1234,
msecs: new Date('2011-11-01').getTime(),
nsecs: 5678
}));
```Use the option `version` to specify which version of UUID to use. Default is v4.