Sha256: 1ac73e6c75d61a467cc62e1e5f93f92a39f43153bbf256b3d68792554d1ebaa5

Contents?: true

Size: 1.22 KB

Versions: 14

Compression:

Stored size: 1.22 KB

Contents

is_defined = function(suspect) {
  return typeof suspect == "undefined" ? false : true;
};

is_undefined = function(suspect) {
  return typeof suspect == "undefined" ? true : false;
};

is_typeof = function(type, suspect) {
  if (is_undefined(type)) {
    throw new Error("is_typeof(Type, suspect): type is undefined");
  }

  if (is_undefined(suspect)) {
    throw new Error("is_typeof(Type, suspect): suspect is undefined");
  }

  return suspect.constructor == type ? true : false;
};

is_numeric = function(suspect) {
  if (isNaN(suspect)) {
    return false;
  }
  return !isNaN(parseFloat(suspect)) && isFinite(suspect);
};

is_string = function(suspect) {
  return is_typeof(String, suspect);
};

is_array = function(suspect) {
  return is_typeof(Array, suspect);
};

is_number = function(suspect) {
  return is_typeof(Number, suspect);
};

is_date = function(suspect) {
  return is_typeof(Date, suspect);
};

is_bool = function(suspect) {
  return is_typeof(Boolean, suspect);
};

is_regex = function(suspect) {
  return is_typeof(RegExp, suspect);
};

is_empty = function(suspect) {
  if (is_undefined(suspect)) {
    return true;
  }

  return suspect.length === 0;
};

is_not_empty = function(suspect) {
  return suspect.length >= 1;
};

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
modjs-architecture-0.3.5 lib/modjs-architecture/helpers/existence.js
modjs-architecture-0.3.3 lib/modjs-architecture/helpers/existence.js
modjs-architecture-0.3.2 lib/modjs-architecture/helpers/existence.js
modjs-architecture-0.3.1 lib/modjs-architecture/helpers/existence.js
modjs-architecture-0.3.0 lib/modjs-architecture/helpers/existence.js
modjs-architecture-0.2.1 lib/modjs-architecture/helpers/existence.js
modjs-architecture-0.2.0 lib/modjs-architecture/helpers/existence.js
modjs-architecture-0.1.6 lib/modjs-architecture/helpers/existence.js
modjs-architecture-0.1.5 lib/modjs-architecture/helpers/existence.js
modjs-architecture-0.1.4 lib/modjs-architecture/helpers/existence.js
modjs-architecture-0.1.3 lib/modjs-architecture/helpers/existence.js
modjs-architecture-0.1.2 lib/modjs-architecture/helpers/existence.js
modjs-architecture-0.1.1 lib/modjs-architecture/helpers/existence.js
modjs-architecture-0.1.0 lib/modjs-architecture/helpers/existence.js