Skip to content

Commit

Permalink
documentation and version updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanlescure committed May 4, 2020
1 parent 5698cac commit 63f3251
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 4 deletions.
45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Deno Short UUID Module

This is a random UUID reneration module which allows you to set your own dictionary and length.

## Platform Support

This repo is pulled as a submodule by the npm package [short-unique-id](https://github.com/jeanlescure/short-unique-id). This allows us to support the following platforms through TypeScript and `deno bundle`:

- Deno
- Node.js
- Browsers

## Documentation

You can find the docs and online generator at:

[https://shortunique.id](https://shortunique.id)

## Example

```js
import ShortUniqueId from 'https://cdn.jsdelivr.net/npm/[email protected]/short_uuid/mod.ts';

const uid = new ShortUniqueId();

// Random UUID of length 6 (default)
console.log(uid()); // x6trff

// Random UUID of length 12
console.log(uid(12)); // wwL44UU5K0z3

const abUid = new ShortUniqueId({
dictionary: ['a', 'b'],
shuffle: false,
});

// Sequential UUID
console.log(abUid.seq()); // a
console.log(abUid.seq()); // b
console.log(abUid.seq()); // ab
console.log(abUid.seq()); // bb
console.log(abUid.seq()); // aab
// ...

```
8 changes: 5 additions & 3 deletions mod.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2017-2020 the Short Unique ID authors. All rights reserved. Apache license.
// Copyright 2017-2020 the Short Unique ID authors. All rights reserved. Apache 2.0 license.
import { version } from './version.json';

type Ranges = {
Expand Down Expand Up @@ -69,9 +69,11 @@ const DEFAULT_OPTIONS: Options = {
* ### Use as module
*
* ```js
* // Import
* // Deno (web module) Import
* import ShortUniqueId from 'https://cdn.jsdelivr.net/npm/[email protected]/short_uuid/mod.ts';
* // ES6 Import
* import ShortUniqueId from 'short-unique-id';
* //or
* //or Node.js require
* const ShortUniqueId = require('short-unique-id');
*
* //Instantiate
Expand Down
9 changes: 9 additions & 0 deletions typedoc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"disableSources": true,
"ignoreCompilerErrors": true,
"includeVersion": true,
"exclude": ["test.ts"],
"excludeExternals": true,
"excludeNotDocumented": true,
"mode": "file"
}
2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version": "2.0.7"}
{"version": "3.0.0-rc1"}

0 comments on commit 63f3251

Please sign in to comment.