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

13 lines
312 B
JavaScript
Raw Permalink Normal View History

2020-08-03 12:04:07 +02:00
/**
* @description Majuscule à la 1ère lettre d'une string.
2020-08-03 12:04:07 +02:00
* @param {String} s
* @returns {String}
* @examples capitalize('hello world!') 'Hello world!'
*/
2020-08-03 12:04:07 +02:00
function capitalize (s) {
if (typeof s !== 'string') return ''
return s.charAt(0).toUpperCase() + s.slice(1)
}
2020-08-03 12:04:07 +02:00
module.exports = capitalize