(
id,
{ minLength = 2, maxLength = bigLength, length = id?.length } = {},
)
| 143 | } |
| 144 | |
| 145 | const 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 | |
| 159 | export const getConstants = () => ({ defaultLength, bigLength }); |
| 160 | export { init }; |
no outgoing calls
no test coverage detected
searching dependent graphs…