This repository has been archived by the owner on May 22, 2019. It is now read-only.
/
is.min.js
1 lines (1 loc) · 2.65 KB
/
is.min.js
1
/*! is-it - v1.2.0 - 2014-04-12 */!function(t,n){"undefined"!=typeof module?module.exports=n():"function"==typeof define&&"object"==typeof define.amd?define(n):this[t]=n()}("is",function(){function t(t,e){e=n.date(e)?e:new Date;var r="getFullYear",u="getMonth",o="getDate";return t[r]()<e[r]()?-1:t[r]()>e[r]()?1:t[u]()<e[u]()?-1:t[u]()>e[u]()?1:t[o]()<e[o]()?-1:t[o]()>e[o]()?1:0}var n={VERSION:"1.2.0",present:function(t){return null!=t&&!n.emtStr(t)},equal:function(t,n){return t==n},greaterThan:function(t,n){return n=n||0,t>n},greaterThanOrEqualTo:function(t,n){return n=n||0,t>=n},lessThan:function(t,n){return n=n||0,n>t},lessThanOrEqualTo:function(t,n){return n=n||0,n>=t},"boolean":function(t){return"boolean"==typeof t},nil:function(t){return null===t},undef:function(t){return void 0===t},object:function(t){return"object"==typeof t},plainObject:function(t){return!t||!n.obj(t)||t.nodeType||n.args(t)||n.arr(t)||n.bool(t)||n.date(t)||n.func(t)||n.num(t)||n.str(t)?!1:t.valueOf&&isNaN(t)||!0},args:function(t){return"[object Arguments]"==Object.prototype.toString.call(t)},array:function(t){return Array.isArray(t)},func:function(t){return"function"==typeof t},string:function(t){return"string"==typeof t},emptyString:function(t){return n.string(t)?""===t.replace(/\s/g,""):!1},number:function(t){return"number"==typeof t&&!isNaN(t)},aNumber:function(t){return isNaN(parseFloat(t))?!1:!0},integer:function(t){return"number"==typeof t&&0===t%1},aInteger:function(t){return n.int(n.toNum(t))},hexadecimal:function(t){return n.not.str(t)&&parseInt(t,16).toString(16)==t},hexadecimalString:function(t){return n.not.str(t)?!1:(t=t.replace(/^0x/i,""),parseInt(t,16).toString(16)==t)},zero:function(t){return 0===t},aZero:function(t){return n.zero(n.toNum(t))},date:function(t){return"[object Date]"==Object.prototype.toString.call(t)},sameDate:function(e,r){return n.date(e)&&n.date(r)&&!t(e,r)},today:function(e){return n.date(e)&&!t(e)},futureDate:function(e,r){return n.date(e)&&t(e,r)>0},pastDate:function(e,r){return n.date(e)&&0>t(e,r)}};n.eq=n.equal,n.gt=n.greaterThan,n.gte=n.greaterThanOrEqualTo,n.lt=n.lessThan,n.lte=n.lessThanOrEqualTo,n.bool=n.boolean,n.obj=n.object,n.arr=n.array,n.str=n.string,n.emtStr=n.emptyString,n.aNum=n.aNumber,n.aInt=n.aInteger,n.num=n.number,n.int=n.integer,n.hex=n.hexadecimal,n.hexStr=n.hexstr=n.hexadecimalString,n.past=n.pastDate,n.future=n.futureDate;var e,r=n.not={};for(e in n)n.hasOwnProperty(e)&&"function"==typeof n[e]&&(r[e]=function(t){return function(){return!n[t].apply(n,arguments)}}(e));return n.toInt=n.toInteger=function(t){var n=parseInt(t,10);return isNaN(n)?null:n},n.toNum=n.toNumber=function(t){var n=parseFloat(t);return isNaN(n)?null:n},n});