Nodejs String Empty Check isEmpty(pattern)

Here you can find the source of isEmpty(pattern)

Method Source Code

/**/*from w  w  w  . ja va  2  s .c om*/
 *  String#empty() -> Boolean
 *
 *  Checks if the string is empty.
 *
 *  ##### Example
 *
 *      ''.empty();
 *      //-> true
 *
 *      '  '.empty();
 *      //-> false
**/
String.prototype.isEmpty = function(pattern) {
  return this == '';
};

Related

  1. isEmpty()
    String.prototype.isEmpty = function(){
        return (this === null || this === '');
    };
    
  2. isEmpty()
    String.prototype.isEmpty = function() {
       return (this.length === 0 || !this.trim());
    Array.prototype.appendStringToElementAtIndex = function(index, str) {
        if(typeof this[index] === 'undefined' || typeof this[index] !== 'string') return false;
        this[index] += ' ' + str;
    };
    
  3. isEmpty()
    String.prototype.isEmpty = function() {
        return (this.length === 0 || !this.trim());
    };
    
  4. isEmpty()
    String.prototype.isEmpty = function(){
        if(typeof this !== 'string') {
            if(typeof this === 'object' && !(this instanceof String)){
                throw {
                    name: 'InvalidType',
                    message: 'The current type is not a String'
        return this.length === 0;
    };
    
  5. isEmpty()
    String.prototype.isEmpty = function() {
      var rtn = (this == null || this == undefined || this.trim() == '');
      return rtn;
    };
    
  6. isEmpty(str)
    String.isEmpty = function(str){
        if(typeof str === 'string'){
            str = str.trim();
        switch(str){
            case "":
            case 0:
            case null:
            case false:
    ...
    
  7. isBlank()
    String.prototype.isBlank = function() { 
      return !this.match(/\S/) 
    
  8. isBlank()
    String.prototype.isBlank = function() {
      return (!this || /^\s*$/.test(this));
    };
    
  9. isBlank()
    String.prototype.isBlank = function() {
        return (this==null || this=="");