UNPKG

@puq/names

Version:

The String Names Library provides a simple names function that takes a string input and returns all possible naming convention variants, such as camelCase, snake_case, CONSTANT_CASE, and more. Perfect for tasks like code generation, formatting standardiza

6 lines (5 loc) 318 B
export function normalize(e, r) { if (r ? r(e) : !!e.match(/^[a-zA-Z_$]{1,}[a-zA-Z0-9_$\-. ]{1,}$/)) return e.replace(/[_\-.]{1,}/g, ' ').replace(/ {1,}/g, ' ').replace(/([a-z])([A-Z])/g, '$1 $2').toLowerCase(); throw Error(`The name string value is not valid: ${e}`); } //# sourceMappingURL=normalize.js.map