Socket
Socket
Sign inDemoInstall

cuid

Package Overview
Dependencies
2
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    cuid

Client-side unique ids


Version published
Weekly downloads
498K
increased by2.58%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

CUID

Collision-resistant client-side UID generator safe for element IDs and server-side lookups. Build Status

.cuid() returns a short random string with some collision-busting measures. Safe to use as HTML element ID's, and unique server-side record lookups.

Example

ch6sgpt5s5lh1ttmg

Broken down

** c - h6sgpt5s - 5l - h1 - ttmg **

The groups, in order, are:

  • 'c' - identifies this as a cuid, and allows you to use it in html entity ids.
  • timestamp
  • Browser fingerprint. The first chars are obtained from the user agent string (which is fairly unique), and the supported mimeTypes (which is also fairly unique, except for IE, which always returns 0).
  • a count of global variables.
  • Math.random().

Keywords

FAQs

Last updated on 12 Sep 2012

Did you know?

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc