@royli/hygen
Version:
The scalable code generator that saves you time.
23 lines (19 loc) • 494 B
text/typescript
import path from 'path'
import inflection from 'inflection'
import changeCase from 'change-case'
// supports kebab-case to KebabCase
inflection.undasherize = (str) =>
str
.split(/[-_]/)
.map((w) => w[0].toUpperCase() + w.slice(1).toLowerCase())
.join('')
const helpers = {
capitalize(str) {
const toBeCapitalized = String(str)
return toBeCapitalized.charAt(0).toUpperCase() + toBeCapitalized.slice(1)
},
inflection,
changeCase,
path,
}
export default helpers