Last change
on this file since 6a80231 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
445 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | unique-slug
|
---|
| 2 | ===========
|
---|
| 3 |
|
---|
| 4 | Generate a unique character string suitible for use in files and URLs.
|
---|
| 5 |
|
---|
| 6 | ```
|
---|
| 7 | var uniqueSlug = require('unique-slug')
|
---|
| 8 |
|
---|
| 9 | var randomSlug = uniqueSlug()
|
---|
| 10 | var fileSlug = uniqueSlug('/etc/passwd')
|
---|
| 11 | ```
|
---|
| 12 |
|
---|
| 13 | ### uniqueSlug(*str*) → String (8 chars)
|
---|
| 14 |
|
---|
| 15 | If *str* is passed in then the return value will be its murmur hash in
|
---|
| 16 | hex.
|
---|
| 17 |
|
---|
| 18 | If *str* is not passed in, it will be 4 randomly generated bytes
|
---|
| 19 | converted into 8 hexadecimal characters.
|
---|
Note:
See
TracBrowser
for help on using the repository browser.