I am looking an equivalent of http://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#isBlank(java.lang.CharSequence) I found several 3rd party extensions, but is there one out of the box with underscore.js: http://underscorejs.org
function isBlank(str) {
return !!(str||'').match(/^\s*$/);
}
isBlank(null); // => true
isBlank(''); // => true
isBlank(' \t '); // => true
isBlank(' foo '); // => false
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With