-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5698cac
commit 63f3251
Showing
4 changed files
with
60 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
// ... | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = { | ||
|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"version": "2.0.7"} | ||
{"version": "3.0.0-rc1"} |