Nodejs String Empty Check isNullOrEmptyString(obj)

Here you can find the source of isNullOrEmptyString(obj)

Method Source Code

function isNullOrEmptyString(obj) {
   if (isNullOrUnderdefined(obj))
      return false;
   if (isStringType(obj)) {
      return obj.length == 0;
   }/*from ww  w  .  j a v  a 2 s. co m*/
   return false;
}

Related

  1. isNullOrEmpty()
    String.prototype.isNullOrEmpty = function() {
      return (!this || 0 === this.length || /^\s*$/.test(this));  
    };
    
  2. isNullOrEmpty()
    String.prototype.isNullOrEmpty = function(){
        return !(this && this.length > 0);
    };
    
  3. isNullOrEmpty()
    String.prototype.isNullOrEmpty = function () {
      return this === null || this.length === 0;
    };
    
  4. isNullOrWhitespace()
    String.prototype.isNullOrWhitespace = function () {
      return this === null || this.replace(/\s/g, '').length === 0;
    };
    
  5. isNullOrWhitespace(input)
    String.isNullOrWhitespace = function( input ) {
      return !input || !input.trim();
    };
    
  6. isEmpty()
    String.prototype.isEmpty = function() {
      return this == '';
    };
    
  7. isEmpty()
    String.prototype.isEmpty = function() {
        return (this.length === 0 || !this.trim());
    };