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

isNullOrEmpty()
String.prototype.isNullOrEmpty = function() {
  return (!this || 0 === this.length || /^\s*$/.test(this));  
};
isNullOrEmpty()
String.prototype.isNullOrEmpty = function(){
    return !(this && this.length > 0);
};
isNullOrEmpty()
String.prototype.isNullOrEmpty = function () {
  return this === null || this.length === 0;
};
isNullOrEmptyString(obj)
function isNullOrEmptyString(obj) {
  if (isNullOrUnderdefined(obj))
    return false;
  if (isStringType(obj)) {
    return obj.length == 0;
  return false;
isNullOrWhitespace()
String.prototype.isNullOrWhitespace = function () {
  return this === null || this.replace(/\s/g, '').length === 0;
};
isNullOrWhitespace(input)
String.isNullOrWhitespace = function( input ) {
  return !input || !input.trim();
};
isEmpty()
String.prototype.isEmpty = function() {
  return this == '';
};
isEmpty()
String.prototype.isEmpty = function() {
    return (this.length === 0 || !this.trim());
};
isEmpty()
"use strict";
String.prototype.isEmpty = function() {
    return (this.length === 0 || !this.trim());
};
isEmpty()
String.prototype.isEmpty = function() {
  return this.length === 0 || !this.trim();
};