Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cuid

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cuid

Collision-resistant ids optimized for horizontal scaling and performance. For node and browsers.

  • 1.2.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
427K
decreased by-5.58%
Maintainers
1
Weekly downloads
 
Created

What is cuid?

The 'cuid' npm package is a library for generating collision-resistant unique identifiers optimized for horizontal scaling and performance. It is designed to be simple, fast, and reliable, making it suitable for use in distributed systems and databases.

What are cuid's main functionalities?

Generate a CUID

This feature allows you to generate a new CUID. The generated ID is a string that is guaranteed to be unique, making it ideal for use as a primary key in databases or as a unique identifier in distributed systems.

const cuid = require('cuid');
const id = cuid();
console.log(id);

Generate a Slug

This feature generates a shorter, URL-friendly version of a CUID, known as a slug. Slugs are useful for creating human-readable URLs or identifiers that need to be shorter than a full CUID.

const cuid = require('cuid');
const slug = cuid.slug();
console.log(slug);

Check if a String is a CUID

This feature allows you to check if a given string is a valid CUID. It returns a boolean value indicating whether the string conforms to the CUID format.

const cuid = require('cuid');
const isCuid = cuid.isCuid('cixl4bq9k0000mh3ea0000001');
console.log(isCuid);

Check if a String is a Slug

This feature allows you to check if a given string is a valid CUID slug. It returns a boolean value indicating whether the string conforms to the slug format.

const cuid = require('cuid');
const isSlug = cuid.isSlug('cixl4bq');
console.log(isSlug);

Other packages similar to cuid

Keywords

FAQs

Package last updated on 20 Apr 2014

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc