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/scripts/functions/fonctions_annexes/capitalize_Function.js

14 lines
350 B
JavaScript

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