MCPcopy
hub / github.com/paralleldrive/cuid2 / isCuid

Function isCuid

src/index.js:145–157  ·  view source on GitHub ↗
(
  id,
  { minLength = 2, maxLength = bigLength, length = id?.length } = {},
)

Source from the content-addressed store, hash-verified

143}
144
145const isCuid = (
146 id,
147 { minLength = 2, maxLength = bigLength, length = id?.length } = {},
148) => {
149 const regex = /^[a-z][0-9a-z]+$/;
150
151 return (
152 typeof id === "string" &&
153 length >= minLength &&
154 length <= maxLength &&
155 regex.test(id)
156 );
157};
158
159export const getConstants = () => ({ defaultLength, bigLength });
160export { init };

Callers 2

bin-test.jsFile · 0.90
index-test.jsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…