MCPcopy Index your code
hub / github.com/coder/coder / nameValidator

Function nameValidator

site/src/utils/formUtils.ts:104–108  ·  view source on GitHub ↗
(name: string)

Source from the content-addressed store, hash-verified

102
103// REMARK: see #1756 for name/username semantics
104export const nameValidator = (name: string): Yup.StringSchema =>
105 Yup.string()
106 .required(`Please enter a ${name.toLowerCase()}.`)
107 .matches(usernameRE, "Special characters (e.g.: !, @, #) are not supported")
108 .max(maxLenName, `${name} cannot be longer than ${maxLenName} characters`);
109
110export const displayNameValidator = (displayName: string): Yup.StringSchema =>
111 Yup.string()

Calls 2

matchesMethod · 0.80
stringMethod · 0.80

Tested by

no test coverage detected