UNPKG

@technobuddha/library

Version:
17 lines (16 loc) 634 B
"use strict"; 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;