From 0232fd890ef273557bc7205cea66bc9fb35d5b1e Mon Sep 17 00:00:00 2001 From: Angelos Chalaris Date: Sat, 6 Jan 2018 13:52:30 +0200 Subject: [PATCH] Update isLowerCase.md --- snippets/isLowerCase.md | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/snippets/isLowerCase.md b/snippets/isLowerCase.md index b975de698..2e5b1305d 100644 --- a/snippets/isLowerCase.md +++ b/snippets/isLowerCase.md @@ -1,17 +1,15 @@ ### isLowerCase -Checks if the provided argument contains anything else than the lowercase alphabets. If the second argument is provided to be true than numbers and other symbols are considered lowercase too. +Checks if a string is lower case. + +Convert the given string to lower case, using `String.toLowerCase()` and compare it to the original. ``` js -const isLowerCase = (val,symbol = false) => { - if (symbol) return val === val.toLowerCase() - else return !(/[^a-z]/g.test(val)) -} +const isLowerCase = str => str === str.toLowerCase(); ``` + ```js -isUpperCase('abc'); //true -isUpperCase('abc123@$'); //false -isUpperCase('abc123@$',true); //true -isUpperCase('abc123@$ABCD',true); //false -isUpperCase('abc123@$ABCD'); //false +isLowerCase('abc'); //true +isLowerCase('a3@$'); //false +isLowerCase('Ab4'); //false ```