Created
October 7, 2013 10:50
-
-
Save ruslansavenok/6865951 to your computer and use it in GitHub Desktop.
Checks If String Contains Only White Spaces
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Checks If String Contains Only White Spaces | |
* | |
* Useful for Fields Validation $input.val().isEmpty() | |
*/ | |
String.prototype.isEmpty = function () { | |
return /^\s*$/.test(this); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Creating regexp for each function call isn't super efficient. This would be faster: