"use strict";

var util = require('util');

exports.is = {
  fun: util.isFunction,
  arr: util.isArray,
  obj: util.isObject,
  str: util.isString,
  bool: util.isBoolean,
  und: util.isUndefined,

  num: function(n) {
    return util.isNumber(n) && !isNaN(n);
  },

  date: function(d) {
    return util.isDate(d) && !isNaN(d);
  },

  exst: function(o) {
    return !util.isUndefined(o) && o !== null;
  },

  yamb: function(o) {
    if (!util.isObject(o) || !o.constructor) {
      return false;
    }

    return o.constructor.name && o.constructor.name === 'Yamb';
  }
};

exports.clone = require('clone');

var stringify = exports.stringify = function(string) {
  return ('' + string).trim();
};

var whitespace = exports.whitespace = function(string) {
  var regex = /^[\s]*$/;
  return regex.test(stringify(string));
};

exports.empty = function(value) {
  if (util.isObject(value)) {
    return !value || Object.keys(value).length === 0;
  } else if (util.isArray(value)) {
    return !value || value.length === 0;
  } else if (util.isString(value)) {
    return whitespace(value);
  }

  return true;
};

exports.compare = function(a1, a2) {
  if (!util.isArray(a1) || !util.isArray(a2)) {
    return false;
  }

  if (a1.length !== a2.length) {
    return false;
  }

  for (var i=0, length=a1.length; i<length; i++) {
    if (a1[i] !== a2[i]) {
      return false;
    }
  }

  return true;
};

exports.pad = function(num) {
  if (num < 10) {
    return '0' + num;
  } else {
    return num;
  }
};
@@ -332,83 +332,8 @@
 %7D,%0A%0A
-  exst: function(o) %7B%0A    return !util.isUndefined(o) && o !== null;%0A  %7D,%0A%0A
   ya
@@ -791,29 +791,15 @@
 if (
-util.isObject(
+!
 value)
-)
  %7B%0A 
@@ -812,59 +812,20 @@
 urn 
-!value %7C%7C Object.keys(value).length === 0;%0A  %7D else
+true;%0A  %7D%0A%0A 
  if 
@@ -832,21 +832,22 @@
 (util.is
-Array
+Object
 (value))
@@ -857,130 +857,68 @@
     
-return !value %7C%7C value.length === 0;%0A  %7D else if (util.isString(value)) %7B%0A    return whitespace(value);%0A  %7D%0A%0A  return true
+value = Object.keys(value);%0A  %7D%0A%0A  return value.length === 0
 ;%0A%7D;

Refactor utils.empty()