UNPKG

666 BJavaScriptView Raw
1/**
2 * Convert string into lower case.
3 * @memberof module:stringcase/lib
4 * @function lowercase
5 * @param {string} str - String to convert.
6 * @returns {string} Lowercase case string.
7 */
8
9'use strict'
10
11/** @lends lowercase */
12function lowercase (str) {
13 str = String(str)
14 if (!str) {
15 return str
16 }
17 return str.toLowerCase()
18}
19
20/**
21 * Checks whether the string are lowercase.
22 * @memberof module:stringcase/lib
23 * @function lowercase.isLowercase
24 * @param {string} str - String to check
25 * @returns {boolean} - True if the string are lowercase.
26 */
27lowercase.isLowercase = function (str) {
28 return str && !/[A-Z]+/.test(str)
29}
30
31module.exports = lowercase;
\No newline at end of file