@technobuddha/library
Version:
A large library of useful functions
17 lines (16 loc) • 634 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.toCapitalWordCase = void 0;
/**
* Capitalize the first letter of each word in a string
*
* @param input The string to capitalize
* @param __namedParameters see {@link Options}
* @default lowercase false
*/
function toCapitalWordCase(input, _a) {
var _b = _a === void 0 ? {} : _a, _c = _b.lowerCase, lowerCase = _c === void 0 ? false : _c;
return (lowerCase ? input.toLowerCase() : input).replace(/\b\w/ug, function (l) { return l.toUpperCase(); });
}
exports.toCapitalWordCase = toCapitalWordCase;
exports.default = toCapitalWordCase;