inflected
Version:
A port of ActiveSupport's inflector to Node.js
15 lines (13 loc) • 321 B
JavaScript
import humanize from "./humanize";
import underscore from "./underscore";
export default function titleize(word) {
return humanize(underscore(word)).replace(/(^|[\s¿/]+)([a-z])/g, function(
match,
boundary,
letter,
idx,
string
) {
return match.replace(letter, letter.toUpperCase());
});
}