UNPKG

tyro-util

Version:
17 lines (14 loc) 360 B
/** * @description 首字母大写 * @param {String} str * @return {String} * * eg. * capitalize('fooBar'); // 'FooBar' * capitalize('fooBar', true); // 'FooBar' */ const capitalize = ([first, ...rest]) => first.toUpperCase() + rest.join('') module.exports = capitalize , (match) => match.toUpperCase()) } module.exports = capitalize