Nodejs String Empty Check isNullOrEmpty()

Here you can find the source of isNullOrEmpty()

Method Source Code

String.prototype.isNullOrEmpty = function() {
  return (!this || 0 === this.length || /^\s*$/.test(this));  
};

Related

  1. isNullOrEmpty()
    String.prototype.isNullOrEmpty = function(){
        return !(this && this.length > 0);
    };
    
  2. isNullOrEmpty()
    String.prototype.isNullOrEmpty = function () {
      return this === null || this.length === 0;
    };
    
  3. isNullOrEmptyString(obj)
    function isNullOrEmptyString(obj) {
      if (isNullOrUnderdefined(obj))
        return false;
      if (isStringType(obj)) {
        return obj.length == 0;
      return false;
    
  4. isNullOrWhitespace()
    String.prototype.isNullOrWhitespace = function () {
      return this === null || this.replace(/\s/g, '').length === 0;
    };