UNPKG

sentence-case

Version:

Transform into a lower case with spaces between words, then capitalize the string

13 lines 415 B
import { split, toLower, toUpper } from "no-case"; export function sentenceCase(input, options) { const lower = toLower(options?.locale); const upper = toUpper(options?.locale); return split(input) .map((word, index) => { if (index === 0) return upper(word[0]) + lower(word.slice(1)); return lower(word); }) .join(" "); } //# sourceMappingURL=index.js.map