https://github.com/deployable/node-deployable-mixin-class_uid
Node Class UID Mixin
https://github.com/deployable/node-deployable-mixin-class_uid
deployable mixins nodejs npm-module uuid
Last synced: 12 months ago
JSON representation
Node Class UID Mixin
- Host: GitHub
- URL: https://github.com/deployable/node-deployable-mixin-class_uid
- Owner: deployable
- Created: 2017-01-03T04:14:23.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-01-03T12:31:00.000Z (about 9 years ago)
- Last Synced: 2025-03-26T16:44:13.211Z (about 1 year ago)
- Topics: deployable, mixins, nodejs, npm-module, uuid
- Language: JavaScript
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# [deployable-mixin-class-uuid](https://github.com/deployable/deployable-mixin-class-uuid)
Node Class UUID Mixin
Attach a UUID to a class as `class_uid` and add `generateUuid()` helper functions
## Install
npm install deployable-mixin-class_uid --save
yarn add deployable-mixin-class_uid
## Usage
```javascript
const mix = require('mixwith').mix
const MixinClassUid = require('deployable-mixin-class_uid')
class SomeMix = {}
class Some extends mix(SomeMix).with(MixinClassUid) {}
let obj = new Some()
console.log(obj.class_uid)
console.log(obj.generateUuid())
```
## API
### `Class.generateUuid(version)`
Static method to generate a uuid. Pass a version `v1` or `v4`
### `.class_uid`
Get or set the uid on the class via a property
### `.generateUuid(version)`
Instance method to generate a uuid. Pass a version `v1` or `v4`
## License
deployable-mixin-class_uid is released under the MIT license.
Copyright 2016 Matt Hoyle
https://github.com/deployable/deployable-mixin-class_uid