Get started with cuid CDN
MIT licensed
CUID: library generating unique, versioned IDs for client-side data.
Tags:- id
- guid
- uid
- unique id
- uuid
Stable version
Copied!
How to start using cuid CDN
// Include the cuid library from the CDN
const cuid = (() => {
const script = document.createElement('script');
script.src = 'https://cdn.cdnhub.io/cuid/3.0.0/browser-cuid.min.js';
document.head.appendChild(script);
return new Promise((resolve) => {
script.onload = () => {
document.head.removeChild(script);
resolve(script.cuid);
};
});
})();
// Generate a new cuid
const newCuid = cuid();
console.log('New cuid:', newCuid);
// Generate a cuid with a custom prefix
const customPrefixCuid = cuid('myPrefix');
console.log('Custom prefix cuid:', customPrefixCuid);