/*! * type-safe v0.1.1 * @license MIT * @copyright 2015 Mac Heller-Ogden * @author Mac Heller-Ogden * @summary Type predicates and assertions. */ !function(t,e){"undefined"!=typeof module&&module.exports?module.exports=e():"function"==typeof define&&"object"==typeof define.amd?define(e):(function(){return this||(0,eval)("this")}())[t]=e()}("typeSafe",function(){function t(t){this.name="TypeError",this.message=t}function e(e,n){return function(r){if(!e(r))throw new t(n(r))}}function n(t){return function(e){return"Expected `"+t+"` and instead received `"+typeof e+"`"}}function r(t){return function(e){var n=typeof e,r=!1,i=!1,o=!0;return"object"!==n||(r=null===e)||(i="[object Array]"===Object.prototype.toString.call(e)),"existy"===t?o=null!=e:"truthy"===t?o=e!==!1&&null!=e:"nan"===t?o="number"===n&&isNaN(e):"number"===t?o=!isNaN(e)&&n===t:"null"===t?o=r:"array"===t?o=i:"object"===t&&(i||r)?o=!1:n!==t&&(o=!1),o}}var i,o,s,u,a,c,f,l,y,d,b;return t.prototype=Error.prototype,i=r("existy"),o=r("truthy"),s=r("nan"),u=r("null"),a=r("undefined"),c=r("string"),f=r("function"),l=r("object"),y=r("array"),d=r("number"),b=r("boolean"),{isExisty:i,isTruthy:o,isNan:s,isNull:u,isUndefined:a,isString:c,isFunction:f,isObject:l,isArray:y,isNumber:d,isBoolean:b,assertExisty:e(i,n("existy")),assertTruthy:e(o,n("truthy")),assertNan:e(s,n("NaN")),assertNull:e(u,n("null")),assertUndefined:e(a,n("undefined")),assertString:e(c,n("string")),assertFunction:e(f,n("function")),assertObject:e(l,n("object")),assertArray:e(y,n("array")),assertNumber:e(d,n("number")),assertBoolean:e(b,n("boolean")),decorate:function(t){t="object"==typeof t?t:(0,eval)("this");for(var e in this)this.hasOwnProperty(e)&&"decorate"!==e&&null==t[e]&&(t[e]=this[e])}}});