This repository has been archived on 2024-10-29. You can view files and clone it, but cannot push or open issues or pull requests.
FunctionProject/api/assets/functions/secondary/capitalize.js
2020-08-03 12:04:07 +02:00

13 lines
312 B
JavaScript

/**
* @description Majuscule à la 1ère lettre d'une string.
* @param {String} s
* @returns {String}
* @examples capitalize('hello world!') → 'Hello world!'
*/
function capitalize (s) {
if (typeof s !== 'string') return ''
return s.charAt(0).toUpperCase() + s.slice(1)
}
module.exports = capitalize