Nodejs String Empty Check isNullOrWhitespace(input)

Here you can find the source of isNullOrWhitespace(input)

Method Source Code

String.isNullOrWhitespace = function( input ) {
  return !input || !input.trim();
};

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. isNullOrEmptyString(obj)
    function isNullOrEmptyString(obj) {
      if (isNullOrUnderdefined(obj))
        return false;
      if (isStringType(obj)) {
        return obj.length == 0;
      return false;
    
  5. isNullOrWhitespace()
    String.prototype.isNullOrWhitespace = function () {
      return this === null || this.replace(/\s/g, '').length === 0;
    };
    
  6. isEmpty()
    String.prototype.isEmpty = function() {
      return this == '';
    };
    
  7. isEmpty()
    String.prototype.isEmpty = function() {
        return (this.length === 0 || !this.trim());
    };
    
  8. isEmpty()
    "use strict";
    String.prototype.isEmpty = function() {
        return (this.length === 0 || !this.trim());
    };
    
  9. isEmpty()
    String.prototype.isEmpty = function() {
      return this.length === 0 || !this.trim();
    };