Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

unique-slug

npm67.2mISC5.0.0TypeScript support: definitely-typed

Generate a unique character string suitible for use in files and URLs.

readme

unique-slug

Generate a unique character string suitible for use in files and URLs.

var uniqueSlug = require('unique-slug')

var randomSlug = uniqueSlug()
var fileSlug = uniqueSlug('/etc/passwd')

uniqueSlug(str) → String (8 chars)

If str is passed in then the return value will be its murmur hash in hex.

If str is not passed in, it will be 4 randomly generated bytes converted into 8 hexadecimal characters.

changelog

Changelog

5.0.0 (2024-09-24)

⚠️ BREAKING CHANGES

  • unique-slug now supports node ^18.17.0 || >=20.5.0

    Bug Fixes

  • cade20a #97 align to npm 10 node engine range (@hashtagchris)

    Chores

  • 1881f90 #97 run template-oss-apply (@hashtagchris)
  • 0a6131f #96 enable auto publish (#96) (@reggi)
  • 06d88e6 #94 bump @npmcli/eslint-config from 4.0.5 to 5.0.0 (@dependabot[bot])
  • 14f6a93 #84 bump @npmcli/template-oss to 4.22.0 (@lukekarrys)
  • a3a1fa5 #36 bump @npmcli/eslint-config from 3.1.0 to 4.0.0 (@dependabot[bot])
  • dd40a9a #95 postinstall for dependabot template-oss PR (@hashtagchris)
  • 3082ca1 #95 bump @npmcli/template-oss from 4.23.1 to 4.23.3 (@dependabot[bot])

4.0.0 (2022-10-10)

⚠️ BREAKING CHANGES

  • unique-slug is now compatible with the following semver range for node: ^14.17.0 || ^16.13.0 || >=18.0.0

Features

  • 81375b9 #29 postinstall for dependabot template-oss PR (@lukekarrys)

3.0.0 (2022-08-22)

⚠ BREAKING CHANGES

  • sets node engines to ^12.13.0 || ^14.15.0 || >=16.0.0

Bug Fixes

  • replace deprecated String.prototype.substr() (bf77b3d)

Dependencies