boats
Version:
Beautiful Open / Async Template System - Write less yaml with BOATS and Nunjucks.
20 lines (19 loc) • 521 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
/**
*
* @param string to ucfirst
* @returns {string}
*/
exports.default = (string) => {
if (typeof string !== 'string') {
throw new Error('Param passed to ucfirst is not type string but type: ' + typeof string);
}
if (string.length === 0) {
return string;
}
if (string.length === 1) {
return string.toLocaleLowerCase();
}
return string.charAt(0).toLocaleLowerCase() + string.slice(1);
};