Merge pull request #506 from kriadmin/isUpperCase

[FEATURE] isUpperCase isLowerCase
This commit is contained in:
Angelos Chalaris
2018-01-06 13:54:10 +02:00
committed by GitHub
2 changed files with 31 additions and 0 deletions

15
snippets/isLowerCase.md Normal file
View File

@ -0,0 +1,15 @@
### isLowerCase
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 = str => str === str.toLowerCase();
```
```js
isLowerCase('abc'); // true
isLowerCase('a3@$'); // true
isLowerCase('Ab4'); // false
```

16
snippets/isUpperCase.md Normal file
View File

@ -0,0 +1,16 @@
### isUpperCase
Checks if a string is upper case.
Convert the given string to upper case, using `String.toUpperCase()` and compare it to the original.
``` js
const isUpperCase = str => str === str.toUpperCase();
```
``` js
isUpperCase('ABC'); // true
isLowerCase('A3@$'); // true
isLowerCase('aB4'); // false
```