Nodejs Utililty Methods String Empty Check

List of utility methods to do String Empty Check

Description

The list of methods to do String Empty Check are organized into topic(s).

Method

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;
};
isEmpty()
String.prototype.isEmpty = function() {
    return (this.length === 0 || !this.trim());
};
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;
};
isEmpty()
String.prototype.isEmpty = function() {
  var rtn = (this == null || this == undefined || this.trim() == '');
  return rtn;
};
isEmpty(pattern)
String.prototype.isEmpty = function(pattern) {
  return this == '';
};
isEmpty(str)
String.isEmpty = function(str){
    if(typeof str === 'string'){
        str = str.trim();
    switch(str){
        case "":
        case 0:
        case null:
        case false:
...
isBlank()
String.prototype.isBlank = function() { 
  return !this.match(/\S/) 
isBlank()
String.prototype.isBlank = function() {
  return (!this || /^\s*$/.test(this));
};
isBlank()
String.prototype.isBlank = function() {
    return (this==null || this=="");
isBlank()
String.prototype.isBlank = function (){
  var str = $.trim(this);
  if(str == "") {
    return true;
  } else {
    return false;