Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/briansipple/ember-simple-uuid
Direct client-side UUID generation with node-uuid's v4 implementation
https://github.com/briansipple/ember-simple-uuid
Last synced: 21 days ago
JSON representation
Direct client-side UUID generation with node-uuid's v4 implementation
- Host: GitHub
- URL: https://github.com/briansipple/ember-simple-uuid
- Owner: BrianSipple
- License: mit
- Created: 2016-02-20T20:57:28.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-01-26T05:22:14.000Z (almost 8 years ago)
- Last Synced: 2024-10-22T03:53:34.199Z (27 days ago)
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/ember-simple-uuid
- Size: 18.6 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# ember-simple-uuid
[![npm version](https://badge.fury.io/js/ember-simple-uuid.svg)](https://badge.fury.io/js/ember-simple-uuid) [![Build Status](https://travis-ci.org/BrianSipple/ember-simple-uuid.svg?branch=master)](https://travis-ci.org/BrianSipple/ember-simple-uuid) [![Ember Observer Score](http://emberobserver.com/badges/ember-simple-uuid.svg)](http://emberobserver.com/addons/ember-simple-uuid)
_Direct client-side UUID generation that exposes [node-uuid](https://github.com/broofa/node-uuid)'s `uuid.v4` implementation as an importable module_.
Original credit for this addon's approach is due to [`ember-cli-uuid`](https://github.com/thaume/ember-cli-uuid).
`ember-simple-uuid` -- this addon -- wraps the same function as `ember-cli-uuid` (`uuid.v4`), but without any dependency on `ember-data` and without an initializer that decorates `DS.Adapter`. Those wanting such extra behavior may well want to give `ember-cli-uuid` a look.`ember-simple-uuid` also [gathers any arguments passed to its function](/addon/utils/uuid.js) and spreads them to fit the `uuid.v4` function signature. This enables the `uuid.v4` configuration options documented [here](https://github.com/broofa/node-uuid#uuidv4options--buffer--offset).
## Usage
### Straight up:
```
import uuid from 'ember-simple-uuid';const babyName = uuid();
// babyName >> 'ad84fb10-19c4-01e1-2b0d-7b25c4ea062'
```
### With arguments -- for example, generating two IDs in a single buffer:
```
import uuid from 'ember-simple-uuid';const myDigits = new Array(32);
uuid(null, myDigits, 0);
uuid(null, myDigits, 16);```
## Building Locally
### Installation
* `git clone` this repository
* `npm install`
* `bower install`### Running
* `ember server`
* Visit your app at http://localhost:4200.### Running Tests
* `npm test` (Runs `ember try:testall` to test your addon against multiple Ember versions)
* `ember test`
* `ember test --server`### Building
* `ember build`
For more information on using ember-cli, visit [http://www.ember-cli.com/](http://www.ember-cli.com/).