UNPKG

477 BJavaScriptView Raw
1/**
2 * Convert string into de-capitalized case.
3 * First letters will be lowercase.
4 * @memberof module:stringcase/lib
5 * @function decapitalcase
6 * @param {string} str - String to convert.
7 * @returns {string} Capital case string.
8 */
9
10'use strict'
11
12const lowercase = require('./lowercase')
13
14/** @lends capitalcase */
15function capitalcase (str) {
16 str = String(str)
17 if (!str) {
18 return str
19 }
20 return lowercase(str[ 0 ]) + str.slice(1)
21}
22
23module.exports = capitalcase