MCPcopy Index your code
hub / github.com/ProNextJS/declarative-routing / jsClean

Function jsClean

src/shared/utils.ts:94–106  ·  view source on GitHub ↗
(str: string)

Source from the content-addressed store, hash-verified

92}
93
94export const jsClean = (str: string) => {
95 // Clean all non-alphanumberic values except for dashes
96 const cleanString = str.replace(/[^a-zA-Z0-9-]/g, "");
97
98 // Capitalize the letter following a dash
99 const capitalizedAfterDash = cleanString.replace(
100 /-([a-zA-Z])/g,
101 (_, letter) => letter.toUpperCase()
102 );
103
104 // Remove all dashes and non-alphanumeric characters
105 return capitalizedAfterDash.replace(/[^a-zA-Z0-9]/g, "");
106};
107
108export const upperFirst = (str: string) =>
109 str.charAt(0).toUpperCase() + str.slice(1);

Callers 1

createInfoFileFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected