Comparing version 0.1.3 to 0.2.0
@@ -1,2 +0,2 @@ | ||
// is.js 0.1.3 | ||
// is.js 0.2.0 | ||
// Author: Aras Atasaygin | ||
@@ -33,3 +33,3 @@ | ||
is = {}; | ||
is.VERSION = '0.1.3'; | ||
is.VERSION = '0.2.0'; | ||
@@ -172,2 +172,7 @@ // define interfaces | ||
// is a given value Char? | ||
is.char = function(value) { | ||
return is.string(value) && value.length === 1; | ||
}; | ||
// is a given value undefined? | ||
@@ -174,0 +179,0 @@ is.undefined = function(value) { |
@@ -1,1 +0,1 @@ | ||
!function(a,b){"function"==typeof define&&define.amd?define(["is"],function(c){return a.is=b(c)}):"object"==typeof exports?module.exports=b(require("is_js")):a.is=b(a.is)}(this,function(a){function b(a){return function(){return!a.apply(null,j.call(arguments))}}function c(b){return function(){var c=j.call(arguments),d=c.length;1===d&&a.array(c[0])&&(c=c[0],d=c.length);for(var e=[],f=0;d>f;f++)e.push(b.call(null,c[f]));for(f=0;f<e.length;f++)if(!e[f])return!1;return!0}}function d(b){return function(){var c=j.call(arguments),d=c.length;1===d&&a.array(c[0])&&(c=c[0],d=c.length);for(var e=[],f=0;d>f;f++)e.push(b.call(null,c[f]));for(f=0;f<e.length;f++)if(e[f])return!0;return!1}}function e(b,c){a[b]=function(a){return c[b].test(a)}}function f(){var e=a;for(var f in e)if(k.call(e,f)&&a["function"](e[f]))for(var g=e[f].api||["not","all","any"],h=0;h<g.length;h++)"not"===g[h]&&(a.not[f]=b(a[f])),"all"===g[h]&&(a.all[f]=c(a[f])),"any"===g[h]&&(a.any[f]=d(a[f]))}var g=this,h=g.is;a={},a.VERSION="0.1.3",a.not={},a.all={},a.any={};var i=Object.prototype.toString,j=Array.prototype.slice,k=Object.prototype.hasOwnProperty;a.arguments=function(b){return a.not["null"](b)&&("[object Arguments]"===i.call(b)||"object"==typeof b&&"callee"in b)},a.array=Array.isArray||function(a){return"[object Array]"===i.call(a)},a["boolean"]=function(a){return a===!0||a===!1||"[object Boolean]"===i.call(a)},a.date=function(a){return"[object Date]"===i.call(a)},a.error=function(a){return"[object Error]"===i.call(a)},a["function"]=function(a){return"[object Function]"===i.call(a)||"function"==typeof a},a.nan=function(b){return a.number(b)&&b!==b},a["null"]=function(a){return null===a||"[object Null]"===i.call(a)},a.number=function(a){return"[object Number]"===i.call(a)},a.object=function(a){var b=typeof a;return"function"===b||"object"===b&&!!a},a.regexp=function(a){return"[object RegExp]"===i.call(a)},a.sameType=function(b,c){return a.nan(b)||a.nan(c)?a.nan(b)===a.nan(c):i.call(b)===i.call(c)},a.sameType.api=["not"],a.string=function(a){return"[object String]"===i.call(a)},a.undefined=function(a){return void 0===a},a.empty=function(b){if(a["null"](b))return!1;if(a.object(b)){for(var c in b)if(b.hasOwnProperty(c))return!1;return!0}return a.array(b)||a.arguments(b)?0===b.length:""===b},a.existy=function(a){return null!==a&&void 0!==a},a.truthy=function(b){return a.existy(b)&&b!==!1},a.falsy=b(a.truthy),a.space=function(b){if(a.string(b)){var c=b.charCodeAt(0);return c>8&&14>c||32===c}return!1},a.equal=function(b,c){return a.all.number(b,c)?b===c&&1/b===1/c:a.all.string(b,c)||a.all.regexp(b,c)?""+b==""+c:a.all["boolean"](b,c)?b===c:!1},a.equal.api=["not"],a.even=function(b){return a.number(b)&&b%2===0},a.odd=function(b){return a.number(b)&&b%2!==0},a.positive=function(b){return a.number(b)&&b>0},a.negative=function(b){return a.number(b)&&0>b},a.above=function(b,c){return a.all.number(b,c)&&b>c},a.above.api=["not"],a.under=function(b,c){return a.all.number(b,c)&&c>b},a.under.api=["not"],a.within=function(b,c,d){return a.all.number(b,c,d)&&b>c&&d>b},a.within.api=["not"],a.decimal=function(b){return a.number(b)&&b%1!==0},a.integer=function(b){return a.number(b)&&b%1===0},a.finite=isFinite||function(b){return 1/0!==b&&b!==-1/0&&a.not.nan(b)},a.infinite=b(a.finite);var l={url:/^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/,email:/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i,creditCard:/^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$/,alphaNumeric:/^[A-Za-z0-9]+$/,timeString:/^(2[0-3]|[01]?[0-9]):([0-5]?[0-9]):([0-5]?[0-9])$/,dateString:/^(1[0-2]|0?[1-9])\/(3[01]|[12][0-9]|0?[1-9])\/(?:[0-9]{2})?[0-9]{2}$/,usZipCode:/^[0-9]{5}(?:-[0-9]{4})?$/,caPostalCode:/^(?!.*[DFIOQU])[A-VXY][0-9][A-Z]?[0-9][A-Z][0-9]$/,ukPostCode:/^[A-Z]{1,2}[0-9R][0-9A-Z]?[0-9][ABD-HJLNP-UW-Z]{2}$/,nanpPhone:/^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/,eppPhone:/^\+[0-9]{1,3}\.[0-9]{4,14}(?:x.+)?$/,socialSecurityNumber:/^(?!000|666)[0-8][0-9]{2}-(?!00)[0-9]{2}-(?!0000)[0-9]{4}$/,affirmative:/^(?:1|t(?:rue)?|y(?:es)?|ok(?:ay)?)$/};for(var m in l)l.hasOwnProperty(m)&&e(m,l);a.include=String.prototype.includes||function(a,b){return a.indexOf(b)>-1},a.include.api=["not"],a.upperCase=function(b){return a.string(b)&&b===b.toUpperCase()},a.lowerCase=function(b){return a.string(b)&&b===b.toLowerCase()},a.startWith=function(b,c){return a.string(b)&&0===b.indexOf(c)},a.startWith.api=["not"],a.endWith=function(b,c){return a.string(b)&&b.indexOf(c)===b.length-c.length},a.endWith.api=["not"],a.capitalized=function(b){if(a.not.string(b))return!1;for(var c=b.split(" "),d=[],e=0;e<c.length;e++)d.push(c[e][0]===c[e][0].toUpperCase());return a.all.truthy.apply(null,d)};var n=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],o=["january","february","march","april","may","june","july","august","september","october","november","december"];if(a.today=function(b){var c=new Date,d=c.toDateString();return a.date(b)&&b.toDateString()===d},a.yesterday=function(b){var c=new Date,d=new Date(c.setDate(c.getDate()-1)).toDateString();return a.date(b)&&b.toDateString()===d},a.tomorrow=function(b){var c=new Date,d=new Date(c.setDate(c.getDate()+1)).toDateString();return a.date(b)&&b.toDateString()===d},a.past=function(b){var c=new Date;return a.date(b)&&b.getTime()<c.getTime()},a.future=b(a.past),a.day=function(b,c){return a.date(b)&&c.toLowerCase()===n[b.getDay()]},a.day.api=["not"],a.month=function(b,c){return a.date(b)&&c.toLowerCase()===o[b.getMonth()]},a.month.api=["not"],a.year=function(b,c){return a.date(b)&&a.number(c)&&c===b.getFullYear()},a.year.api=["not"],a.weekend=function(b){return a.date(b)&&(6===b.getDay()||0===b.getDay())},a.weekday=b(a.weekend),a.inDateRange=function(b,c,d){if(a.not.date(b)||a.not.date(c)||a.not.date(d))return!1;var e=b.getTime(),f=c.getTime(),g=d.getTime();return e>f&&g>e},a.inDateRange.api=["not"],a.inLastWeek=function(b){return a.inDateRange(b,new Date((new Date).setDate((new Date).getDate()-7)),new Date)},a.inLastMonth=function(b){return a.inDateRange(b,new Date((new Date).setMonth((new Date).getMonth()-1)),new Date)},a.inLastYear=function(b){return a.inDateRange(b,new Date((new Date).setFullYear((new Date).getFullYear()-1)),new Date)},a.inNextWeek=function(b){return a.inDateRange(b,new Date,new Date((new Date).setDate((new Date).getDate()+7)))},a.inNextMonth=function(b){return a.inDateRange(b,new Date,new Date((new Date).setMonth((new Date).getMonth()+1)))},a.inNextYear=function(b){return a.inDateRange(b,new Date,new Date((new Date).setFullYear((new Date).getFullYear()+1)))},a.quarterOfYear=function(b,c){return a.date(b)&&a.number(c)&&c===Math.floor((b.getMonth()+3)/3)},a.quarterOfYear.api=["not"],a.dayLightSavingTime=function(a){var b=new Date(a.getFullYear(),0,1),c=new Date(a.getFullYear(),6,1),d=Math.max(b.getTimezoneOffset(),c.getTimezoneOffset());return a.getTimezoneOffset()<d},"undefined"!=typeof window){var p="navigator"in window&&navigator.userAgent.toLowerCase()||"",q="navigator"in window&&navigator.vendor.toLowerCase()||"",r="navigator"in window&&navigator.appVersion.toLowerCase()||"";a.chrome=function(){return/chrome|chromium/i.test(p)&&/google inc/.test(q)},a.chrome.api=["not"],a.firefox=function(){return/firefox/i.test(p)},a.firefox.api=["not"],a.ie=function(a){return a?new RegExp("msie "+a).test(p):/msie/i.test(p)},a.ie.api=["not"],a.opera=function(){return/opr/i.test(p)},a.opera.api=["not"],a.safari=function(){return/safari/i.test(p)&&/apple computer/i.test(q)},a.safari.api=["not"],a.ios=function(){return a.iphone()||a.ipad()||a.ipod()},a.ios.api=["not"],a.iphone=function(){return/iphone/i.test(p)},a.iphone.api=["not"],a.ipad=function(){return/ipad/i.test(p)},a.ipad.api=["not"],a.ipod=function(){return/ipod/i.test(p)},a.ipod.api=["not"],a.android=function(){return/android/i.test(p)},a.android.api=["not"],a.androidPhone=function(){return/android/i.test(p)&&/mobile/i.test(p)},a.androidPhone.api=["not"],a.androidTablet=function(){return/android/i.test(p)&&!/mobile/i.test(p)},a.androidTablet.api=["not"],a.blackberry=function(){return/blackberry/i.test(p)},a.blackberry.api=["not"],a.desktop=function(){return a.not.mobile()&&a.not.tablet()},a.desktop.api=["not"],a.linux=function(){return/linux/i.test(r)},a.linux.api=["not"],a.mac=function(){return/mac/i.test(r)},a.mac.api=["not"],a.windows=function(){return/win/i.test(r)},a.windows.api=["not"],a.windowsPhone=function(){return a.windows()&&/phone/i.test(p)},a.windowsPhone.api=["not"],a.windowsTablet=function(){return a.windows()&&a.not.windowsPhone()&&/touch/i.test(p)},a.windowsTablet.api=["not"],a.mobile=function(){return a.iphone()||a.ipod()||a.androidPhone()||a.blackberry()||a.windowsPhone()},a.mobile.api=["not"],a.tablet=function(){return a.ipad()||a.androidTablet()||a.windowsTablet()},a.tablet.api=["not"],a.online=function(){return navigator.onLine},a.online.api=["not"],a.offline=b(a.online),a.offline.api=["not"]}return a.propertyCount=function(b,c){if(!a.object(b)||!a.number(c))return!1;if(Object.keys)return Object.keys(b).length===c;var d,e=[];for(d in b)k.call(b,d)&&e.push(d);return e.length===c},a.propertyCount.api=["not"],a.propertyDefined=function(b,c){return a.object(b)&&a.string(c)&&c in b},a.propertyDefined.api=["not"],a.windowObject=function(a){return"object"==typeof a&&"setInterval"in a},a.inArray=function(b,c){if(a.not.array(c))return!1;for(var d=0;d<c.length;d++)if(c[d]===b)return!0;return!1},a.inArray.api=["not"],a.sorted=function(b){if(a.not.array(b))return!1;for(var c=0;c<b.length;c++)if(b[c]>b[c+1])return!1;return!0},f(),a.setRegexp=function(a,b){for(var c in l)k.call(l,c)&&b===c&&(l[c]=a)},a.setNamespace=function(){return g.is=h,this},a}); | ||
!function(a,b){"function"==typeof define&&define.amd?define(["is"],function(c){return a.is=b(c)}):"object"==typeof exports?module.exports=b(require("is_js")):a.is=b(a.is)}(this,function(a){function b(a){return function(){return!a.apply(null,j.call(arguments))}}function c(b){return function(){var c=j.call(arguments),d=c.length;1===d&&a.array(c[0])&&(c=c[0],d=c.length);for(var e=[],f=0;d>f;f++)e.push(b.call(null,c[f]));for(f=0;f<e.length;f++)if(!e[f])return!1;return!0}}function d(b){return function(){var c=j.call(arguments),d=c.length;1===d&&a.array(c[0])&&(c=c[0],d=c.length);for(var e=[],f=0;d>f;f++)e.push(b.call(null,c[f]));for(f=0;f<e.length;f++)if(e[f])return!0;return!1}}function e(b,c){a[b]=function(a){return c[b].test(a)}}function f(){var e=a;for(var f in e)if(k.call(e,f)&&a["function"](e[f]))for(var g=e[f].api||["not","all","any"],h=0;h<g.length;h++)"not"===g[h]&&(a.not[f]=b(a[f])),"all"===g[h]&&(a.all[f]=c(a[f])),"any"===g[h]&&(a.any[f]=d(a[f]))}var g=this,h=g.is;a={},a.VERSION="0.2.0",a.not={},a.all={},a.any={};var i=Object.prototype.toString,j=Array.prototype.slice,k=Object.prototype.hasOwnProperty;a.arguments=function(b){return a.not["null"](b)&&("[object Arguments]"===i.call(b)||"object"==typeof b&&"callee"in b)},a.array=Array.isArray||function(a){return"[object Array]"===i.call(a)},a["boolean"]=function(a){return a===!0||a===!1||"[object Boolean]"===i.call(a)},a.date=function(a){return"[object Date]"===i.call(a)},a.error=function(a){return"[object Error]"===i.call(a)},a["function"]=function(a){return"[object Function]"===i.call(a)||"function"==typeof a},a.nan=function(b){return a.number(b)&&b!==b},a["null"]=function(a){return null===a||"[object Null]"===i.call(a)},a.number=function(a){return"[object Number]"===i.call(a)},a.object=function(a){var b=typeof a;return"function"===b||"object"===b&&!!a},a.regexp=function(a){return"[object RegExp]"===i.call(a)},a.sameType=function(b,c){return a.nan(b)||a.nan(c)?a.nan(b)===a.nan(c):i.call(b)===i.call(c)},a.sameType.api=["not"],a.string=function(a){return"[object String]"===i.call(a)},a["char"]=function(b){return a.string(b)&&1===b.length},a.undefined=function(a){return void 0===a},a.empty=function(b){if(a["null"](b))return!1;if(a.object(b)){for(var c in b)if(b.hasOwnProperty(c))return!1;return!0}return a.array(b)||a.arguments(b)?0===b.length:""===b},a.existy=function(a){return null!==a&&void 0!==a},a.truthy=function(b){return a.existy(b)&&b!==!1},a.falsy=b(a.truthy),a.space=function(b){if(a.string(b)){var c=b.charCodeAt(0);return c>8&&14>c||32===c}return!1},a.equal=function(b,c){return a.all.number(b,c)?b===c&&1/b===1/c:a.all.string(b,c)||a.all.regexp(b,c)?""+b==""+c:a.all["boolean"](b,c)?b===c:!1},a.equal.api=["not"],a.even=function(b){return a.number(b)&&b%2===0},a.odd=function(b){return a.number(b)&&b%2!==0},a.positive=function(b){return a.number(b)&&b>0},a.negative=function(b){return a.number(b)&&0>b},a.above=function(b,c){return a.all.number(b,c)&&b>c},a.above.api=["not"],a.under=function(b,c){return a.all.number(b,c)&&c>b},a.under.api=["not"],a.within=function(b,c,d){return a.all.number(b,c,d)&&b>c&&d>b},a.within.api=["not"],a.decimal=function(b){return a.number(b)&&b%1!==0},a.integer=function(b){return a.number(b)&&b%1===0},a.finite=isFinite||function(b){return 1/0!==b&&b!==-1/0&&a.not.nan(b)},a.infinite=b(a.finite);var l={url:/^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/,email:/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i,creditCard:/^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$/,alphaNumeric:/^[A-Za-z0-9]+$/,timeString:/^(2[0-3]|[01]?[0-9]):([0-5]?[0-9]):([0-5]?[0-9])$/,dateString:/^(1[0-2]|0?[1-9])\/(3[01]|[12][0-9]|0?[1-9])\/(?:[0-9]{2})?[0-9]{2}$/,usZipCode:/^[0-9]{5}(?:-[0-9]{4})?$/,caPostalCode:/^(?!.*[DFIOQU])[A-VXY][0-9][A-Z]?[0-9][A-Z][0-9]$/,ukPostCode:/^[A-Z]{1,2}[0-9R][0-9A-Z]?[0-9][ABD-HJLNP-UW-Z]{2}$/,nanpPhone:/^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/,eppPhone:/^\+[0-9]{1,3}\.[0-9]{4,14}(?:x.+)?$/,socialSecurityNumber:/^(?!000|666)[0-8][0-9]{2}-(?!00)[0-9]{2}-(?!0000)[0-9]{4}$/,affirmative:/^(?:1|t(?:rue)?|y(?:es)?|ok(?:ay)?)$/};for(var m in l)l.hasOwnProperty(m)&&e(m,l);a.include=String.prototype.includes||function(a,b){return a.indexOf(b)>-1},a.include.api=["not"],a.upperCase=function(b){return a.string(b)&&b===b.toUpperCase()},a.lowerCase=function(b){return a.string(b)&&b===b.toLowerCase()},a.startWith=function(b,c){return a.string(b)&&0===b.indexOf(c)},a.startWith.api=["not"],a.endWith=function(b,c){return a.string(b)&&b.indexOf(c)===b.length-c.length},a.endWith.api=["not"],a.capitalized=function(b){if(a.not.string(b))return!1;for(var c=b.split(" "),d=[],e=0;e<c.length;e++)d.push(c[e][0]===c[e][0].toUpperCase());return a.all.truthy.apply(null,d)};var n=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],o=["january","february","march","april","may","june","july","august","september","october","november","december"];if(a.today=function(b){var c=new Date,d=c.toDateString();return a.date(b)&&b.toDateString()===d},a.yesterday=function(b){var c=new Date,d=new Date(c.setDate(c.getDate()-1)).toDateString();return a.date(b)&&b.toDateString()===d},a.tomorrow=function(b){var c=new Date,d=new Date(c.setDate(c.getDate()+1)).toDateString();return a.date(b)&&b.toDateString()===d},a.past=function(b){var c=new Date;return a.date(b)&&b.getTime()<c.getTime()},a.future=b(a.past),a.day=function(b,c){return a.date(b)&&c.toLowerCase()===n[b.getDay()]},a.day.api=["not"],a.month=function(b,c){return a.date(b)&&c.toLowerCase()===o[b.getMonth()]},a.month.api=["not"],a.year=function(b,c){return a.date(b)&&a.number(c)&&c===b.getFullYear()},a.year.api=["not"],a.weekend=function(b){return a.date(b)&&(6===b.getDay()||0===b.getDay())},a.weekday=b(a.weekend),a.inDateRange=function(b,c,d){if(a.not.date(b)||a.not.date(c)||a.not.date(d))return!1;var e=b.getTime(),f=c.getTime(),g=d.getTime();return e>f&&g>e},a.inDateRange.api=["not"],a.inLastWeek=function(b){return a.inDateRange(b,new Date((new Date).setDate((new Date).getDate()-7)),new Date)},a.inLastMonth=function(b){return a.inDateRange(b,new Date((new Date).setMonth((new Date).getMonth()-1)),new Date)},a.inLastYear=function(b){return a.inDateRange(b,new Date((new Date).setFullYear((new Date).getFullYear()-1)),new Date)},a.inNextWeek=function(b){return a.inDateRange(b,new Date,new Date((new Date).setDate((new Date).getDate()+7)))},a.inNextMonth=function(b){return a.inDateRange(b,new Date,new Date((new Date).setMonth((new Date).getMonth()+1)))},a.inNextYear=function(b){return a.inDateRange(b,new Date,new Date((new Date).setFullYear((new Date).getFullYear()+1)))},a.quarterOfYear=function(b,c){return a.date(b)&&a.number(c)&&c===Math.floor((b.getMonth()+3)/3)},a.quarterOfYear.api=["not"],a.dayLightSavingTime=function(a){var b=new Date(a.getFullYear(),0,1),c=new Date(a.getFullYear(),6,1),d=Math.max(b.getTimezoneOffset(),c.getTimezoneOffset());return a.getTimezoneOffset()<d},"undefined"!=typeof window){var p="navigator"in window&&navigator.userAgent.toLowerCase()||"",q="navigator"in window&&navigator.vendor.toLowerCase()||"",r="navigator"in window&&navigator.appVersion.toLowerCase()||"";a.chrome=function(){return/chrome|chromium/i.test(p)&&/google inc/.test(q)},a.chrome.api=["not"],a.firefox=function(){return/firefox/i.test(p)},a.firefox.api=["not"],a.ie=function(a){return a?new RegExp("msie "+a).test(p):/msie/i.test(p)},a.ie.api=["not"],a.opera=function(){return/opr/i.test(p)},a.opera.api=["not"],a.safari=function(){return/safari/i.test(p)&&/apple computer/i.test(q)},a.safari.api=["not"],a.ios=function(){return a.iphone()||a.ipad()||a.ipod()},a.ios.api=["not"],a.iphone=function(){return/iphone/i.test(p)},a.iphone.api=["not"],a.ipad=function(){return/ipad/i.test(p)},a.ipad.api=["not"],a.ipod=function(){return/ipod/i.test(p)},a.ipod.api=["not"],a.android=function(){return/android/i.test(p)},a.android.api=["not"],a.androidPhone=function(){return/android/i.test(p)&&/mobile/i.test(p)},a.androidPhone.api=["not"],a.androidTablet=function(){return/android/i.test(p)&&!/mobile/i.test(p)},a.androidTablet.api=["not"],a.blackberry=function(){return/blackberry/i.test(p)},a.blackberry.api=["not"],a.desktop=function(){return a.not.mobile()&&a.not.tablet()},a.desktop.api=["not"],a.linux=function(){return/linux/i.test(r)},a.linux.api=["not"],a.mac=function(){return/mac/i.test(r)},a.mac.api=["not"],a.windows=function(){return/win/i.test(r)},a.windows.api=["not"],a.windowsPhone=function(){return a.windows()&&/phone/i.test(p)},a.windowsPhone.api=["not"],a.windowsTablet=function(){return a.windows()&&a.not.windowsPhone()&&/touch/i.test(p)},a.windowsTablet.api=["not"],a.mobile=function(){return a.iphone()||a.ipod()||a.androidPhone()||a.blackberry()||a.windowsPhone()},a.mobile.api=["not"],a.tablet=function(){return a.ipad()||a.androidTablet()||a.windowsTablet()},a.tablet.api=["not"],a.online=function(){return navigator.onLine},a.online.api=["not"],a.offline=b(a.online),a.offline.api=["not"]}return a.propertyCount=function(b,c){if(!a.object(b)||!a.number(c))return!1;if(Object.keys)return Object.keys(b).length===c;var d,e=[];for(d in b)k.call(b,d)&&e.push(d);return e.length===c},a.propertyCount.api=["not"],a.propertyDefined=function(b,c){return a.object(b)&&a.string(c)&&c in b},a.propertyDefined.api=["not"],a.windowObject=function(a){return"object"==typeof a&&"setInterval"in a},a.inArray=function(b,c){if(a.not.array(c))return!1;for(var d=0;d<c.length;d++)if(c[d]===b)return!0;return!1},a.inArray.api=["not"],a.sorted=function(b){if(a.not.array(b))return!1;for(var c=0;c<b.length;c++)if(b[c]>b[c+1])return!1;return!0},f(),a.setRegexp=function(a,b){for(var c in l)k.call(l,c)&&b===c&&(l[c]=a)},a.setNamespace=function(){return g.is=h,this},a}); |
{ | ||
"name": "is_js", | ||
"version": "0.1.3", | ||
"version": "0.2.0", | ||
"main": "is.js", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
167
README.md
@@ -13,3 +13,3 @@ is.js | ||
----------------------- | ||
####Checks if given value type is arguments. | ||
####Checks if the given value type is arguments. | ||
interfaces: not, all, any | ||
@@ -42,3 +42,3 @@ | ||
------------------- | ||
####Checks if given value type is array. | ||
####Checks if the given value type is array. | ||
interfaces: not, all, any | ||
@@ -66,3 +66,3 @@ | ||
--------------------- | ||
####Checks if given value type is boolean. | ||
####Checks if the given value type is boolean. | ||
interfaces: not, all, any | ||
@@ -90,3 +90,3 @@ | ||
------------------ | ||
####Checks if given value type is date. | ||
####Checks if the given value type is date. | ||
interfaces: not, all, any | ||
@@ -114,3 +114,3 @@ | ||
------------------- | ||
####Checks if given value type is error. | ||
####Checks if the given value type is error. | ||
interfaces: not, all, any | ||
@@ -138,3 +138,3 @@ | ||
---------------------- | ||
####Checks if given value type is function. | ||
####Checks if the given value type is function. | ||
interfaces: not, all, any | ||
@@ -162,3 +162,3 @@ | ||
----------------- | ||
####Checks if given value type is NaN. | ||
####Checks if the given value type is NaN. | ||
interfaces: not, all, any | ||
@@ -186,3 +186,3 @@ | ||
------------------ | ||
####Checks if given value type is null. | ||
####Checks if the given value type is null. | ||
interfaces: not, all, any | ||
@@ -210,3 +210,3 @@ | ||
-------------------- | ||
####Checks if given value type is number. | ||
####Checks if the given value type is number. | ||
interfaces: not, all, any | ||
@@ -234,3 +234,3 @@ | ||
-------------------- | ||
####Checks if given value type is object. | ||
####Checks if the given value type is object. | ||
interfaces: not, all, any | ||
@@ -262,3 +262,3 @@ | ||
-------------------- | ||
####Checks if given value type is RegExp. | ||
####Checks if the given value type is RegExp. | ||
interfaces: not, all, any | ||
@@ -286,3 +286,3 @@ | ||
-------------------- | ||
####Checks if given value type is string. | ||
####Checks if the given value type is string. | ||
interfaces: not, all, any | ||
@@ -308,5 +308,28 @@ | ||
is.char(value:any) | ||
-------------------- | ||
####Checks if the given value type is char. | ||
interfaces: not, all, any | ||
```javascript | ||
is.char('f'); | ||
=> true | ||
is.not.char(['foo']); | ||
=> true | ||
is.all.char('f', 1); | ||
=> false | ||
is.any.char('f', 2); | ||
=> true | ||
// 'all' and 'any' interfaces can also take array parameter | ||
is.all.char(['f', 'o', 'o']); | ||
=> true | ||
``` | ||
is.undefined(value:any) | ||
----------------------- | ||
####Checks if given value type is undefined. | ||
####Checks if the given value type is undefined. | ||
interfaces: not, all, any | ||
@@ -334,3 +357,3 @@ | ||
--------------------------------- | ||
####Checks if given value types are same type. | ||
####Checks if the given value types are same type. | ||
interface: not | ||
@@ -354,3 +377,3 @@ | ||
----------------------------------- | ||
####Checks if given value is empty. | ||
####Checks if the given value is empty. | ||
interfaces: not, all, any | ||
@@ -384,3 +407,3 @@ | ||
-------------------- | ||
####Checks if given value is existy. (not null or undefined) | ||
####Checks if the given value is existy. (not null or undefined) | ||
interfaces: not, all, any | ||
@@ -411,3 +434,3 @@ | ||
-------------------- | ||
####Checks if given value is truthy. (existy and not false) | ||
####Checks if the given value is truthy. (existy and not false) | ||
interfaces: not, all, any | ||
@@ -438,3 +461,3 @@ | ||
------------------- | ||
####Checks if given value is falsy. | ||
####Checks if the given value is falsy. | ||
interfaces: not, all, any | ||
@@ -465,3 +488,3 @@ | ||
---------------------- | ||
####Checks if given value is space. | ||
####Checks if the given value is space. | ||
interfaces: not, all, any | ||
@@ -495,3 +518,3 @@ | ||
----------------- | ||
####Checks if given value matches url regexp. | ||
####Checks if the given value matches url regexp. | ||
interfaces: not, all, any | ||
@@ -522,3 +545,3 @@ | ||
------------------- | ||
####Checks if given value matches email regexp. | ||
####Checks if the given value matches email regexp. | ||
interfaces: not, all, any | ||
@@ -549,3 +572,3 @@ | ||
------------------------ | ||
####Checks if given value matches credit card regexp. | ||
####Checks if the given value matches credit card regexp. | ||
interfaces: not, all, any | ||
@@ -576,3 +599,3 @@ | ||
-------------------------- | ||
####Checks if given value matches alpha numeric regexp. | ||
####Checks if the given value matches alpha numeric regexp. | ||
interfaces: not, all, any | ||
@@ -603,3 +626,3 @@ | ||
------------------------ | ||
####Checks if given value matches time string regexp. | ||
####Checks if the given value matches time string regexp. | ||
interfaces: not, all, any | ||
@@ -630,3 +653,3 @@ | ||
------------------------ | ||
####Checks if given value matches date string regexp. | ||
####Checks if the given value matches date string regexp. | ||
interfaces: not, all, any | ||
@@ -657,3 +680,3 @@ | ||
----------------------- | ||
####Checks if given value matches US zip code regexp. | ||
####Checks if the given value matches US zip code regexp. | ||
interfaces: not, all, any | ||
@@ -684,3 +707,3 @@ | ||
-------------------------- | ||
####Checks if given value matches Canada postal code regexp. | ||
####Checks if the given value matches Canada postal code regexp. | ||
interfaces: not, all, any | ||
@@ -711,3 +734,3 @@ | ||
------------------------ | ||
####Checks if given value matches UK post code regexp. | ||
####Checks if the given value matches UK post code regexp. | ||
interfaces: not, all, any | ||
@@ -738,3 +761,3 @@ | ||
----------------------- | ||
####Checks if given value matches North American numbering plan phone regexp. | ||
####Checks if the given value matches North American numbering plan phone regexp. | ||
interfaces: not, all, any | ||
@@ -765,3 +788,3 @@ | ||
---------------------- | ||
####Checks if given value matches extensible provisioning protocol phone regexp. | ||
####Checks if the given value matches extensible provisioning protocol phone regexp. | ||
interfaces: not, all, any | ||
@@ -792,3 +815,3 @@ | ||
---------------------------------- | ||
####Checks if given value matches social security number regexp. | ||
####Checks if the given value matches social security number regexp. | ||
interfaces: not, all, any | ||
@@ -819,3 +842,3 @@ | ||
------------------------- | ||
####Checks if given value matches affirmative regexp. | ||
####Checks if the given value matches affirmative regexp. | ||
interfaces: not, all, any | ||
@@ -849,3 +872,3 @@ | ||
----------------------------------------- | ||
####Checks if given string contains a substring. | ||
####Checks if the given string contains a substring. | ||
interface: not | ||
@@ -866,3 +889,3 @@ | ||
-------------------------- | ||
####Checks if given string is UPPERCASE. | ||
####Checks if the given string is UPPERCASE. | ||
interfaces: not, all, any | ||
@@ -894,3 +917,3 @@ | ||
-------------------------- | ||
####Checks if given string is lowercase. | ||
####Checks if the given string is lowercase. | ||
interfaces: not, all, any | ||
@@ -921,3 +944,3 @@ | ||
------------------------------------------- | ||
####Checks if given string starts with substring. | ||
####Checks if the given string starts with substring. | ||
interface: not | ||
@@ -938,3 +961,3 @@ | ||
----------------------------------------- | ||
####Checks if given string ends with substring. | ||
####Checks if the given string ends with substring. | ||
interfaces: not | ||
@@ -958,3 +981,3 @@ | ||
--------------------------------------------- | ||
####Checks if given string is capitalized. | ||
####Checks if the given string is capitalized. | ||
interfaces: not, all, any | ||
@@ -991,3 +1014,3 @@ | ||
------------------------------ | ||
####Checks if given values are equal. | ||
####Checks if the given values are equal. | ||
interfaces: not | ||
@@ -1011,3 +1034,3 @@ | ||
--------------------- | ||
####Checks if given value is even. | ||
####Checks if the given value is even. | ||
interfaces: not, all, any | ||
@@ -1035,3 +1058,3 @@ | ||
-------------------- | ||
####Checks if given value is odd. | ||
####Checks if the given value is odd. | ||
interfaces: not, all, any | ||
@@ -1059,3 +1082,3 @@ | ||
------------------------- | ||
####Checks if given value is positive. | ||
####Checks if the given value is positive. | ||
interfaces: not, all, any | ||
@@ -1083,3 +1106,3 @@ | ||
------------------------- | ||
####Checks if given value is negative. | ||
####Checks if the given value is negative. | ||
interfaces: not, all, any | ||
@@ -1107,3 +1130,3 @@ | ||
--------------------------- | ||
####Checks if given value is above minimum value. | ||
####Checks if the given value is above minimum value. | ||
interface: not | ||
@@ -1121,3 +1144,3 @@ | ||
--------------------------- | ||
####Checks if given value is under maximum value. | ||
####Checks if the given value is under maximum value. | ||
interface: not | ||
@@ -1135,3 +1158,3 @@ | ||
--------------------------------- | ||
####Checks if given value is within minimum and maximum values. | ||
####Checks if the given value is within minimum and maximum values. | ||
interface: not | ||
@@ -1149,3 +1172,3 @@ | ||
------------------------ | ||
####Checks if given value is decimal. | ||
####Checks if the given value is decimal. | ||
interfaces: not, all, any | ||
@@ -1173,3 +1196,3 @@ | ||
------------------------ | ||
####Checks if given value is integer. | ||
####Checks if the given value is integer. | ||
interfaces: not, all, any | ||
@@ -1197,3 +1220,3 @@ | ||
----------------------- | ||
####Checks if given value is finite. | ||
####Checks if the given value is finite. | ||
interfaces: not, all, any | ||
@@ -1221,3 +1244,3 @@ | ||
------------------------- | ||
####Checks if given value is infinite. | ||
####Checks if the given value is infinite. | ||
interfaces: not, all, any | ||
@@ -1264,3 +1287,3 @@ | ||
------------------------------------------ | ||
####Checks if given property is defined on object. | ||
####Checks if the given property is defined on object. | ||
interface: not | ||
@@ -1281,3 +1304,3 @@ | ||
----------------------------- | ||
####Checks if given object is window object. | ||
####Checks if the given object is window object. | ||
interfaces: not, all, any | ||
@@ -1311,3 +1334,3 @@ | ||
--------------------- | ||
####Checks if given item is in array? | ||
####Checks if the given item is in array? | ||
interface: not | ||
@@ -1327,3 +1350,3 @@ ```javascript | ||
---------------------- | ||
####Checks if given array is sorted. | ||
####Checks if the given array is sorted. | ||
interfaces: not, all, any | ||
@@ -1665,3 +1688,3 @@ | ||
---------------------- | ||
####Checks if given date object indicate today. | ||
####Checks if the given date object indicate today. | ||
interfaces: not, all, any | ||
@@ -1694,3 +1717,3 @@ | ||
-------------------------- | ||
####Checks if given date object indicate yesterday. | ||
####Checks if the given date object indicate yesterday. | ||
interfaces: not, all, any | ||
@@ -1723,3 +1746,3 @@ | ||
------------------------- | ||
####Checks if given date object indicate tomorrow. | ||
####Checks if the given date object indicate tomorrow. | ||
interfaces: not, all, any | ||
@@ -1752,3 +1775,3 @@ | ||
--------------------- | ||
####Checks if given date object indicate past. | ||
####Checks if the given date object indicate past. | ||
interfaces: not, all, any | ||
@@ -1782,3 +1805,3 @@ | ||
----------------------- | ||
####Checks if given date object indicate future. | ||
####Checks if the given date object indicate future. | ||
interfaces: not, all, any | ||
@@ -1812,3 +1835,3 @@ | ||
------------------------------- | ||
####Checks if given date objects' day equal given dayString parameter. | ||
####Checks if the given date objects' day equal given dayString parameter. | ||
interface: not | ||
@@ -1831,3 +1854,3 @@ | ||
----------------------------------- | ||
####Checks if given date objects' month equal given monthString parameter. | ||
####Checks if the given date objects' month equal given monthString parameter. | ||
interface: not | ||
@@ -1850,3 +1873,3 @@ | ||
--------------------------------- | ||
####Checks if given date objects' year equal given yearNumber parameter. | ||
####Checks if the given date objects' year equal given yearNumber parameter. | ||
interface: not | ||
@@ -1869,3 +1892,3 @@ | ||
------------------------ | ||
####Checks if given date objects' day is weekend. | ||
####Checks if the given date objects' day is weekend. | ||
interfaces: not, all, any | ||
@@ -1899,3 +1922,3 @@ | ||
------------------------ | ||
####Checks if given date objects' day is weekday. | ||
####Checks if the given date objects' day is weekday. | ||
interfaces: not, all, any | ||
@@ -1948,3 +1971,3 @@ | ||
--------------------------- | ||
####Checks if given date is between now and 7 days ago. | ||
####Checks if the given date is between now and 7 days ago. | ||
interface: not | ||
@@ -1967,3 +1990,3 @@ | ||
---------------------------- | ||
####Checks if given date is between now and a month ago. | ||
####Checks if the given date is between now and a month ago. | ||
interface: not | ||
@@ -1986,3 +2009,3 @@ | ||
--------------------------- | ||
####Checks if given date is between now and a year ago. | ||
####Checks if the given date is between now and a year ago. | ||
interface: not | ||
@@ -2005,3 +2028,3 @@ | ||
--------------------------- | ||
####Checks if given date is between now and 7 days later. | ||
####Checks if the given date is between now and 7 days later. | ||
interface: not | ||
@@ -2024,3 +2047,3 @@ | ||
---------------------------- | ||
####Checks if given date is between now and a month later. | ||
####Checks if the given date is between now and a month later. | ||
interface: not | ||
@@ -2043,3 +2066,3 @@ | ||
--------------------------- | ||
####Checks if given date is between now and a year later. | ||
####Checks if the given date is between now and a year later. | ||
interface: not | ||
@@ -2062,3 +2085,3 @@ | ||
--------------------------------------------- | ||
####Checks if given date is in the parameter quarter. | ||
####Checks if the given date is in the parameter quarter. | ||
interface: not | ||
@@ -2081,3 +2104,3 @@ | ||
-------------------------------------------------- | ||
####Checks if given date is in daylight saving time. | ||
####Checks if the given date is in daylight saving time. | ||
interface: not | ||
@@ -2084,0 +2107,0 @@ |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
468636
13
12974
2076