@sumor/database
Version:
A database connector for MySQL, etc. Based on entity.
17 lines (14 loc) • 353 B
JavaScript
export default (text, spliter, lower) => {
spliter = spliter || '_'
text = text.toLowerCase()
const arr = text.split(spliter)
text = ''
for (const i in arr) {
const str = arr[i]
text += str.replace(str[0], str[0].toUpperCase())
}
if (lower !== false) {
text = text.replace(text[0], text[0].toLowerCase())
}
return text
}