Generate a unique identifier for your most peaceful projects. A simple, URL-friendly ID generator inspired by Azure's static site generator URLs and using nanoid under the hood.
Note that by default, these identifiers are not guaranteed to be collision resistant, but through the configuration options can be made collision resistant.
npm install serene-id
Generate a serene ID. By default, if no options are specified, an 11-digit Nano ID will be used in conjunction with the serene name.
Pass a function to generate your own unique identifier at the end of the serene ID.
If no custom generator is used, specify the length of the identifier to add to the end of the serene ID. Default is 12.
A separator to use instead of the default dashes (e.g. underscore or space). Default is -
.
A boolean, signifying whether to skip applying an identifier to the end of the serene ID, and receive only a serene name (e.g. harmonious-creek
). Default is false
.
Get the full list of adjectives available as an array.
Get the full list of nouns available as an array.
const sereneId = require('serene-id')
const { v4: uuidv4 } = require('uuid')
// using slug-friendly (default)
console.log(sereneId())
// => harmonious-creek-Fw0LTHgglNz
// using uuid
console.log(sereneId({ generator: uuidv4 }))
// => adorable-leaf-efccd1d4-4eb7-40b4-ac96-e187bb6f5608
MIT, see LICENSE for details.