🚀 Socket Launch Week 🚀 Day 5: Introducing Socket Fix.Learn More
Socket
Sign inDemoInstall
Socket

unique-slug

Package Overview
Dependencies
Maintainers
6
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unique-slug

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

5.0.0
latest
Source
npm
Version published
Weekly downloads
22M
-8.72%
Maintainers
6
Weekly downloads
 
Created

What is unique-slug?

The unique-slug npm package is a simple utility for generating unique, random slugs that can be used for file names, URLs, unique identifiers, etc. It uses a combination of the current timestamp and a random string to ensure uniqueness.

What are unique-slug's main functionalities?

Generate a unique slug

This feature generates a unique slug that can be used where a unique string is needed, such as for a unique filename or URL component.

const uniqueSlug = require('unique-slug');
const slug = uniqueSlug();
console.log(slug);

Generate a unique slug with a prefix

This feature allows for the generation of a unique slug with a specified prefix, which can be useful for categorizing or identifying the type of resource the slug represents.

const uniqueSlug = require('unique-slug');
const prefix = 'img_';
const slugWithPrefix = uniqueSlug(prefix);
console.log(slugWithPrefix);

Other packages similar to unique-slug

FAQs

Package last updated on 25 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts