Closed alelopezperez closed 1 year ago
cuid::is_cuid
const isCuid = (id, { minLength = 2, maxLength = bigLength } = {}) => { const length = id.length; const regex = /^[0-9a-z]+$/; try { if ( typeof id === "string" && length >= minLength && length <= maxLength && regex.test(id) ) return true; } finally { } return false; };
Sorry for the slow response on this. Just recently finished up moving across the country, so things have been hectic!
Hi, I noticed that
cuid::is_cuid
is now deprecated since it follows non cuid2 standards. I checked the original isCuid2 from paralleldrive implementation and transcribed to a similar function from the deprecratedcuid::is_cuid
Original JS Implementation
link to original JS implementation
The requirements are as follows
Added Requirements by me