diff --git a/dev/Common/Globals.js b/dev/Common/Globals.js index 18dd2e90d..cf5e999b1 100644 --- a/dev/Common/Globals.js +++ b/dev/Common/Globals.js @@ -7,6 +7,7 @@ Globals = {}, window = require('window'), + is = require('is'), _ = require('_'), $ = require('$'), ko = require('ko'), @@ -68,24 +69,14 @@ Globals.bUnload = false; /** - * @type {string} + * @type {boolean} */ - Globals.sUserAgent = (window.navigator.userAgent || '').toLowerCase(); + Globals.bTabletDevice = is.tablet(); /** * @type {boolean} */ - Globals.bIsiOSDevice = -1 < Globals.sUserAgent.indexOf('iphone') || -1 < Globals.sUserAgent.indexOf('ipod') || -1 < Globals.sUserAgent.indexOf('ipad'); - - /** - * @type {boolean} - */ - Globals.bIsAndroidDevice = -1 < Globals.sUserAgent.indexOf('android'); - - /** - * @type {boolean} - */ - Globals.bMobileDevice = Globals.bIsiOSDevice || Globals.bIsAndroidDevice; + Globals.bMobileDevice = is.mobile() || is.tablet(); /** * @type {boolean} diff --git a/dev/Common/Utils.js b/dev/Common/Utils.js index be4a99957..6c6f8e8ab 100644 --- a/dev/Common/Utils.js +++ b/dev/Common/Utils.js @@ -325,61 +325,6 @@ }; }()); - Utils.audio = (function () { - - var - oAudio = false - ; - - return function (sMp3File, sOggFile) { - - if (false === oAudio) - { - if (Globals.bIsiOSDevice) - { - oAudio = null; - } - else - { - var - bCanPlayMp3 = false, - bCanPlayOgg = false, - oAudioLocal = window.Audio ? new window.Audio() : null - ; - - if (oAudioLocal && oAudioLocal.canPlayType && oAudioLocal.play) - { - bCanPlayMp3 = '' !== oAudioLocal.canPlayType('audio/mpeg; codecs="mp3"'); - if (!bCanPlayMp3) - { - bCanPlayOgg = '' !== oAudioLocal.canPlayType('audio/ogg; codecs="vorbis"'); - } - - if (bCanPlayMp3 || bCanPlayOgg) - { - oAudio = oAudioLocal; - oAudio.preload = 'none'; - oAudio.loop = false; - oAudio.autoplay = false; - oAudio.muted = false; - oAudio.src = bCanPlayMp3 ? sMp3File : sOggFile; - } - else - { - oAudio = null; - } - } - else - { - oAudio = null; - } - } - } - - return oAudio; - }; - }()); - /** * @param {(Object|null|undefined)} oObject * @param {string} sProp diff --git a/gulpfile.js b/gulpfile.js index e88d86ef6..86c1507d3 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -141,6 +141,7 @@ cfg.paths.js = { src: [ 'vendors/modernizr.js', 'vendors/underscore/1.6.0/underscore-min.js', + 'vendors/is.js/is.min.js', 'vendors/jquery/jquery-1.11.2.min.js', 'vendors/jquery-ui/js/jquery-ui-1.10.3.custom.min.js', // 'vendors/jquery-ui.touch-punch/jquery.ui.touch-punch.min.js', diff --git a/vendors/is.js/LICENSE b/vendors/is.js/LICENSE new file mode 100644 index 000000000..077f5b9d3 --- /dev/null +++ b/vendors/is.js/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-2015 Aras Atasaygin + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendors/is.js/README.md b/vendors/is.js/README.md new file mode 100644 index 000000000..b42f00deb --- /dev/null +++ b/vendors/is.js/README.md @@ -0,0 +1,2327 @@ +is.js +===== +####This is a general-purpose check library. +- No dependencies +- AMD, Node & browser ready + +Node.js: +``` +npm install is_js +``` + +Bower: +``` +bower install is_js +``` + +Type checks +=========== + +is.arguments(value:any) +----------------------- +####Checks if the given value type is arguments. +interfaces: not, all, any + +```javascript +var getArguments = function() { + return arguments; +}; +var arguments = getArguments(); + +is.arguments(arguments); +=> true + +is.not.arguments({foo: 'bar'}); +=> true + +is.all.arguments(arguments, 'bar'); +=> false + +is.any.arguments(['foo'], arguments); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.arguments([arguments, 'foo', 'bar']); +=> false +``` + +is.array(value:any) +------------------- +####Checks if the given value type is array. +interfaces: not, all, any + +```javascript +is.array(['foo', 'bar', 'baz']); +=> true + +is.not.array({foo: 'bar'}); +=> true + +is.all.array(['foo'], 'bar'); +=> false + +is.any.array(['foo'], 'bar'); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.array([[1, 2], 'foo', 'bar']); +=> false +``` + +is.boolean(value:any) +--------------------- +####Checks if the given value type is boolean. +interfaces: not, all, any + +```javascript +is.boolean(true); +=> true + +is.not.boolean({foo: 'bar'}); +=> true + +is.all.boolean(true, 'bar'); +=> false + +is.any.boolean(true, 'bar'); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.boolean([true, 'foo', 'bar']); +=> false +``` + +is.date(value:any) +------------------ +####Checks if the given value type is date. +interfaces: not, all, any + +```javascript +is.date(new Date()); +=> true + +is.not.date({foo: 'bar'}); +=> true + +is.all.date(new Date(), 'bar'); +=> false + +is.any.date(new Date(), 'bar'); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.date([new Date(), 'foo', 'bar']); +=> false +``` + +is.error(value:any) +------------------- +####Checks if the given value type is error. +interfaces: not, all, any + +```javascript +is.error(new Error()); +=> true + +is.not.error({foo: 'bar'}); +=> true + +is.all.error(new Error(), 'bar'); +=> false + +is.any.error(new Error(), 'bar'); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.error([new Error(), 'foo', 'bar']); +=> false +``` + +is.function(value:any) +---------------------- +####Checks if the given value type is function. +interfaces: not, all, any + +```javascript +is.function(toString); +=> true + +is.not.function({foo: 'bar'}); +=> true + +is.all.function(toString, 'bar'); +=> false + +is.any.function(toString, 'bar'); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.function([toString, 'foo', 'bar']); +=> false +``` + +is.nan(value:any) +----------------- +####Checks if the given value type is NaN. +interfaces: not, all, any + +```javascript +is.nan(NaN); +=> true + +is.not.nan(42); +=> true + +is.all.nan(NaN, 1); +=> false + +is.any.nan(NaN, 2); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.nan([NaN, 'foo', 1]); +=> false +``` + +is.null(value:any) +------------------ +####Checks if the given value type is null. +interfaces: not, all, any + +```javascript +is.null(null); +=> true + +is.not.null(42); +=> true + +is.all.null(null, 1); +=> false + +is.any.null(null, 2); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.null([null, 'foo', 1]); +=> false +``` + +is.number(value:any) +-------------------- +####Checks if the given value type is number. +interfaces: not, all, any + +```javascript +is.number(42); +=> true + +is.not.number('42'); +=> true + +is.all.number('foo', 1); +=> false + +is.any.number({}, 2); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.number([42, 'foo', 1]); +=> false +``` + +is.object(value:any) +-------------------- +####Checks if the given value type is object. +interfaces: not, all, any + +```javascript +is.object({foo: 'bar'}); +=> true + +// functions are also returning as true +is.object(toString); +=> true + +is.not.object('foo'); +=> true + +is.all.object({}, 1); +=> false + +is.any.object({}, 2); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.object([{}, new Object()]); +=> true +``` + +is.json(value:any) +-------------------- +####Checks if the given value type is pure json object. +interfaces: not, all, any + +```javascript +is.json({foo: 'bar'}); +=> true + +// functions are returning as false +is.json(toString); +=> false + +is.not.json([]); +=> true + +is.all.json({}, 1); +=> false + +is.any.json({}, 2); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.json([{}, {foo: 'bar'}]); +=> true +``` + +is.regexp(value:any) +-------------------- +####Checks if the given value type is RegExp. +interfaces: not, all, any + +```javascript +is.regexp(/test/); +=> true + +is.not.regexp(['foo']); +=> true + +is.all.regexp(/test/, 1); +=> false + +is.any.regexp(new RegExp('ab+c'), 2); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.regexp([{}, /test/]); +=> false +``` + +is.string(value:any) +-------------------- +####Checks if the given value type is string. +interfaces: not, all, any + +```javascript +is.string('foo'); +=> true + +is.not.string(['foo']); +=> true + +is.all.string('foo', 1); +=> false + +is.any.string('foo', 2); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.string([{}, 'foo']); +=> false +``` + +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 the given value type is undefined. +interfaces: not, all, any + +```javascript +is.undefined(undefined); +=> true + +is.not.undefined(null); +=> true + +is.all.undefined(undefined, 1); +=> false + +is.any.undefined(undefined, 2); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.undefined([{}, undefined]); +=> false +``` + +is.sameType(value:any, value:any) +--------------------------------- +####Checks if the given value types are same type. +interface: not + +```javascript +is.sameType(42, 7); +=> true + +is.sameType(42, '7'); +=> false + +is.not.sameType(42, 7); +=> false +``` + +Presence checks +=============== + +is.empty(value:object|array|string) +----------------------------------- +####Checks if the given value is empty. +interfaces: not, all, any + +```javascript +is.empty({}); +=> true + +is.empty([]); +=> true + +is.empty(''); +=> true + +is.not.empty(['foo']); +=> true + +is.all.empty('', {}, ['foo']); +=> false + +is.any.empty([], 42); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.empty([{}, 'foo']); +=> false +``` + +is.existy(value:any) +-------------------- +####Checks if the given value is existy. (not null or undefined) +interfaces: not, all, any + +```javascript +is.existy({}); +=> true + +is.existy(null); +=> false + +is.not.existy(undefined); +=> true + +is.all.existy(null, ['foo']); +=> false + +is.any.existy(undefined, 42); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.existy([{}, 'foo']); +=> true +``` + +is.truthy(value:any) +-------------------- +####Checks if the given value is truthy. (existy and not false) +interfaces: not, all, any + +```javascript +is.truthy(true); +=> true + +is.truthy(null); +=> false + +is.not.truthy(false); +=> true + +is.all.truthy(null, true); +=> false + +is.any.truthy(undefined, true); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.truthy([{}, true]); +=> true +``` + +is.falsy(value:any) +------------------- +####Checks if the given value is falsy. +interfaces: not, all, any + +```javascript +is.falsy(false); +=> true + +is.falsy(null); +=> true + +is.not.falsy(true); +=> true + +is.all.falsy(null, false); +=> true + +is.any.falsy(undefined, true); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.falsy([false, true, undefined]); +=> false +``` + +is.space(value:string) +---------------------- +####Checks if the given value is space. +interfaces: not, all, any + +```javascript +is.space(' '); +=> true + +is.space('foo'); +=> false + +is.not.space(true); +=> true + +is.all.space(' ', 'foo'); +=> false + +is.any.space(' ', true); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.space([' ', 'foo', undefined]); +=> false +``` + +RegExp checks +============= + +is.url(value:any) +----------------- +####Checks if the given value matches url regexp. +interfaces: not, all, any + +```javascript +is.url('http://www.test.com'); +=> true + +is.url('foo'); +=> false + +is.not.url(true); +=> true + +is.all.url('http://www.test.com', 'foo'); +=> false + +is.any.url('http://www.test.com', true); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.url(['http://www.test.com', 'foo', undefined]); +=> false +``` + +is.email(value:any) +------------------- +####Checks if the given value matches email regexp. +interfaces: not, all, any + +```javascript +is.email('test@test.com'); +=> true + +is.email('foo'); +=> false + +is.not.email('foo'); +=> true + +is.all.email('test@test.com', 'foo'); +=> false + +is.any.email('test@test.com', 'foo'); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.email(['test@test.com', 'foo', undefined]); +=> false +``` + +is.creditCard(value:any) +------------------------ +####Checks if the given value matches credit card regexp. +interfaces: not, all, any + +```javascript +is.creditCard(378282246310005); +=> true + +is.creditCard(123); +=> false + +is.not.creditCard(123); +=> true + +is.all.creditCard(378282246310005, 123); +=> false + +is.any.creditCard(378282246310005, 123); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.creditCard([378282246310005, 123, undefined]); +=> false +``` + +is.alphaNumeric(value:any) +-------------------------- +####Checks if the given value matches alpha numeric regexp. +interfaces: not, all, any + +```javascript +is.alphaNumeric('alphaNu3er1k'); +=> true + +is.alphaNumeric('*?'); +=> false + +is.not.alphaNumeric('*?'); +=> true + +is.all.alphaNumeric('alphaNu3er1k', '*?'); +=> false + +is.any.alphaNumeric('alphaNu3er1k', '*?'); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.alphaNumeric(['alphaNu3er1k', '*?']); +=> false +``` + +is.timeString(value:any) +------------------------ +####Checks if the given value matches time string regexp. +interfaces: not, all, any + +```javascript +is.timeString('13:45:30'); +=> true + +is.timeString('90:90:90'); +=> false + +is.not.timeString('90:90:90'); +=> true + +is.all.timeString('13:45:30', '90:90:90'); +=> false + +is.any.timeString('13:45:30', '90:90:90'); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.timeString(['13:45:30', '90:90:90']); +=> false +``` + +is.dateString(value:any) +------------------------ +####Checks if the given value matches date string regexp. +interfaces: not, all, any + +```javascript +is.dateString('11/11/2011'); +=> true + +is.dateString('90/11/2011'); +=> false + +is.not.dateString('90/11/2011'); +=> true + +is.all.dateString('11/11/2011', '90/11/2011'); +=> false + +is.any.dateString('11/11/2011', '90/11/2011'); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.dateString(['11/11/2011', '90/11/2011']); +=> false +``` + +is.usZipCode(value:any) +----------------------- +####Checks if the given value matches US zip code regexp. +interfaces: not, all, any + +```javascript +is.usZipCode('02201-1020'); +=> true + +is.usZipCode('123'); +=> false + +is.not.usZipCode('123'); +=> true + +is.all.usZipCode('02201-1020', '123'); +=> false + +is.any.usZipCode('02201-1020', '123'); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.usZipCode(['02201-1020', '123']); +=> false +``` + +is.caPostalCode(value:any) +-------------------------- +####Checks if the given value matches Canada postal code regexp. +interfaces: not, all, any + +```javascript +is.caPostalCode('L8V3Y1'); +=> true + +is.caPostalCode('L8V 3Y1'); +=> true + +is.caPostalCode('123'); +=> false + +is.not.caPostalCode('123'); +=> true + +is.all.caPostalCode('L8V3Y1', '123'); +=> false + +is.any.caPostalCode('L8V3Y1', '123'); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.caPostalCode(['L8V3Y1', '123']); +=> false +``` + +is.ukPostCode(value:any) +------------------------ +####Checks if the given value matches UK post code regexp. +interfaces: not, all, any + +```javascript +is.ukPostCode('B184BJ'); +=> true + +is.ukPostCode('123'); +=> false + +is.not.ukPostCode('123'); +=> true + +is.all.ukPostCode('B184BJ', '123'); +=> false + +is.any.ukPostCode('B184BJ', '123'); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.ukPostCode(['B184BJ', '123']); +=> false +``` + +is.nanpPhone(value:any) +----------------------- +####Checks if the given value matches North American numbering plan phone regexp. +interfaces: not, all, any + +```javascript +is.nanpPhone('609-555-0175'); +=> true + +is.nanpPhone('123'); +=> false + +is.not.nanpPhone('123'); +=> true + +is.all.nanpPhone('609-555-0175', '123'); +=> false + +is.any.nanpPhone('609-555-0175', '123'); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.nanpPhone(['609-555-0175', '123']); +=> false +``` + +is.eppPhone(value:any) +---------------------- +####Checks if the given value matches extensible provisioning protocol phone regexp. +interfaces: not, all, any + +```javascript +is.eppPhone('+90.2322456789'); +=> true + +is.eppPhone('123'); +=> false + +is.not.eppPhone('123'); +=> true + +is.all.eppPhone('+90.2322456789', '123'); +=> false + +is.any.eppPhone('+90.2322456789', '123'); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.eppPhone(['+90.2322456789', '123']); +=> false +``` + +is.socialSecurityNumber(value:any) +---------------------------------- +####Checks if the given value matches social security number regexp. +interfaces: not, all, any + +```javascript +is.socialSecurityNumber('017-90-7890'); +=> true + +is.socialSecurityNumber('123'); +=> false + +is.not.socialSecurityNumber('123'); +=> true + +is.all.socialSecurityNumber('017-90-7890', '123'); +=> false + +is.any.socialSecurityNumber('017-90-7890', '123'); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.socialSecurityNumber(['017-90-7890', '123']); +=> false +``` + +is.affirmative(value:any) +------------------------- +####Checks if the given value matches affirmative regexp. +interfaces: not, all, any + +```javascript +is.affirmative('yes'); +=> true + +is.affirmative('no'); +=> false + +is.not.affirmative('no'); +=> true + +is.all.affirmative('yes', 'no'); +=> false + +is.any.affirmative('yes', 'no'); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.affirmative(['yes', 'y', 'true', 't', 'ok', 'okay']); +=> true +``` + +is.hexadecimal(value:any) +------------------------- +####Checks if the given value matches hexadecimal regexp. +interfaces: not, all, any + +```javascript +is.hexadecimal('f0f0f0'); +=> true + +is.hexadecimal(2.5); +=> false + +is.not.hexadecimal('string'); +=> true + +is.all.hexadecimal('ff', 'f50'); +=> true + +is.any.hexadecimal('ff5500', true); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.hexadecimal(['fff', '333', 'f50']); +=> true +``` + +is.hexColor(value:any) +------------------------- +####Checks if the given value matches hexcolor regexp. +interfaces: not, all, any + +```javascript +is.hexColor('#333'); +=> true + +is.hexColor('#3333'); +=> false + +is.not.hexColor(0.5); +=> true + +is.all.hexColor('fff', 'f50'); +=> true + +is.any.hexColor('ff5500', 0.5); +=> false + +// 'all' and 'any' interfaces can also take array parameter +is.all.hexColor(['fff', '333', 'f50']); +=> true +``` + +is.ip(value:string) +------------------------- +####Checks if the given value matches ip regexp +interfaces: not, all, any + +```javascript +is.ip('198.156.23.5'); +=> true + +is.ip('1.2..5'); +=> false + +is.not.ip('8:::::::7'); +=> true + +is.all.ip('0:1::4:ff5:54:987:C', '123.123.123.123'); +=> true + +is.any.ip('123.8.4.3', '0.0.0.0'); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.ip(['123.123.23.12', 'A:B:C:D:E:F:0:0']); +=> true +``` + +is.ipv4(value:string) +------------------------- +####Checks if the given value matches ipv4 regexp +interfaces: not, all, any + +```javascript +is.ipv4('198.12.3.142'); +=> true + +is.ipv4('1.2..5'); +=> false + +is.not.ipv4('8:::::::7'); +=> true + +is.all.ipv4('198.12.3.142', '123.123.123.123'); +=> true + +is.any.ipv4('255.255.255.255', '850..1.4'); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.ipv4(['198.12.3.142', '1.2.3']); +=> false + +``` + +is.ipv6(value:string) +------------------------- +####Checks if the given value matches ipv6 regexp +interfaces: not, all, any + +```javascript +is.ipv6('2001:DB8:0:0:1::1'); +=> true + +is.ipv6('985.12.3.4'); +=> true + +is.not.ipv6('8:::::::7'); +=> true + +is.all.ipv6('2001:DB8:0:0:1::1', '1:50:198:2::1:2:8'); +=> true + +is.any.ipv6('255.255.255.255', '2001:DB8:0:0:1::1'); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.ipv6(['2001:DB8:0:0:1::1', '1.2.3']); +=> false +``` + +String checks +============= + +is.include(value:string, value:substring) +----------------------------------------- +####Checks if the given string contains a substring. +interface: not + +```javascript +is.include('Some text goes here', 'text'); +=> true + +is.include('test', 'text'); +=> false + +is.not.include('test', 'text'); +=> true +``` + +is.upperCase(value:string) +-------------------------- +####Checks if the given string is UPPERCASE. +interfaces: not, all, any + +```javascript +is.upperCase('YEAP'); +=> true + +is.upperCase('nope'); +=> false + +is.not.upperCase('Nope'); +=> true + +is.all.upperCase('YEAP', 'nope'); +=> false + +is.any.upperCase('YEAP', 'nope'); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.upperCase(['YEAP', 'ALL UPPERCASE']); +=> true +``` + + +is.lowerCase(value:string) +-------------------------- +####Checks if the given string is lowercase. +interfaces: not, all, any + +```javascript +is.lowerCase('yeap'); +=> true + +is.lowerCase('NOPE'); +=> false + +is.not.lowerCase('Nope'); +=> true + +is.all.lowerCase('yeap', 'NOPE'); +=> false + +is.any.lowerCase('yeap', 'NOPE'); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.lowerCase(['yeap', 'all lowercase']); +=> true +``` + +is.startWith(value:string, value:substring) +------------------------------------------- +####Checks if the given string starts with substring. +interface: not + +```javascript +is.startWith('yeap', 'ye'); +=> true + +is.startWith('nope', 'ye'); +=> false + +is.not.startWith('nope not that', 'not'); +=> true +``` + +is.endWith(value:string, value:substring) +----------------------------------------- +####Checks if the given string ends with substring. +interfaces: not + +```javascript +is.endWith('yeap', 'ap'); +=> true + +is.endWith('nope', 'no'); +=> false + +is.not.endWith('nope not that', 'not'); +=> true + +is.endWith('yeap that one', 'one'); +=> true +``` + +is.capitalized(value:string, value:substring) +--------------------------------------------- +####Checks if the given string is capitalized. +interfaces: not, all, any + +```javascript +is.capitalized('Yeap'); +=> true + +is.capitalized('nope'); +=> false + +is.not.capitalized('nope not capitalized'); +=> true + +is.not.capitalized('nope Capitalized'); +=> true + +is.all.capitalized('Yeap', 'All', 'Capitalized'); +=> true + +is.any.capitalized('Yeap', 'some', 'Capitalized'); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.capitalized(['Nope', 'not']); +=> false +``` + +is.palindrome(value:string, value:substring) +--------------------------------------------- +####Checks if the given string is palindrome. +interfaces: not, all, any + +```javascript +is.palindrome('testset'); +=> true + +is.palindrome('nope'); +=> false + +is.not.palindrome('nope not palindrome'); +=> true + +is.not.palindrome('tt'); +=> false + +is.all.palindrome('testset', 'tt'); +=> true + +is.any.palindrome('Yeap', 'some', 'testset'); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.palindrome(['Nope', 'testset']); +=> false +``` + +Arithmetic checks +================= + +is.equal(value:any, value:any) +------------------------------ +####Checks if the given values are equal. +interfaces: not + +```javascript +is.equal(42, 40 + 2); +=> true + +is.equal('yeap', 'yeap'); +=> true + +is.equal(true, true); +=> true + +is.not.equal('yeap', 'nope'); +=> true +``` + +is.even(value:number) +--------------------- +####Checks if the given value is even. +interfaces: not, all, any + +```javascript +is.even(42); +=> true + +is.not.even(41); +=> true + +is.all.even(40, 42, 44); +=> true + +is.any.even(39, 42, 43); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.even([40, 42, 43]); +=> false +``` + +is.odd(value:number) +-------------------- +####Checks if the given value is odd. +interfaces: not, all, any + +```javascript +is.odd(41); +=> true + +is.not.odd(42); +=> true + +is.all.odd(39, 41, 43); +=> true + +is.any.odd(39, 42, 44); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.odd([40, 42, 43]); +=> false +``` + +is.positive(value:number) +------------------------- +####Checks if the given value is positive. +interfaces: not, all, any + +```javascript +is.positive(41); +=> true + +is.not.positive(-42); +=> true + +is.all.positive(39, 41, 43); +=> true + +is.any.positive(-39, 42, -44); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.positive([40, 42, -43]); +=> false +``` + +is.negative(value:number) +------------------------- +####Checks if the given value is negative. +interfaces: not, all, any + +```javascript +is.negative(-41); +=> true + +is.not.negative(42); +=> true + +is.all.negative(-39, -41, -43); +=> true + +is.any.negative(-39, 42, 44); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.negative([40, 42, -43]); +=> false +``` + +is.above(value:number, min) +--------------------------- +####Checks if the given value is above minimum value. +interface: not + +```javascript +is.above(41, 30); +=> true + +is.not.above(42, 50); +=> true +``` + +is.under(value:number, min) +--------------------------- +####Checks if the given value is under maximum value. +interface: not + +```javascript +is.under(30, 35); +=> true + +is.not.under(42, 30); +=> true +``` + +is.within(value:number, min, max) +--------------------------------- +####Checks if the given value is within minimum and maximum values. +interface: not + +```javascript +is.within(30, 20, 40); +=> true + +is.not.within(40, 30, 35); +=> true +``` + +is.decimal(value:number) +------------------------ +####Checks if the given value is decimal. +interfaces: not, all, any + +```javascript +is.decimal(41.5); +=> true + +is.not.decimal(42); +=> true + +is.all.decimal(39.5, 41.5, -43.5); +=> true + +is.any.decimal(-39, 42.5, 44); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.decimal([40, 42.5, -43]); +=> false +``` + +is.integer(value:number) +------------------------ +####Checks if the given value is integer. +interfaces: not, all, any + +```javascript +is.integer(41); +=> true + +is.not.integer(42.5); +=> true + +is.all.integer(39, 41, -43); +=> true + +is.any.integer(-39, 42.5, 44); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.integer([40, 42.5, -43]); +=> false +``` + +is.finite(value:number) +----------------------- +####Checks if the given value is finite. +interfaces: not, all, any + +```javascript +is.finite(41); +=> true + +is.not.finite(42 / 0); +=> true + +is.all.finite(39, 41, -43); +=> true + +is.any.finite(-39, Infinity, 44); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.finite([Infinity, -Infinity, 42.5]); +=> false +``` + +is.infinite(value:number) +------------------------- +####Checks if the given value is infinite. +interfaces: not, all, any + +```javascript +is.infinite(Infinity); +=> true + +is.not.infinite(42); +=> true + +is.all.infinite(Infinity, -Infinity, -43 / 0); +=> true + +is.any.infinite(-39, Infinity, 44); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.infinite([Infinity, -Infinity, 42.5]); +=> false +``` + +Object checks +============= + +is.propertyCount(value:object, count) +------------------------------------- +####Checks if objects' property count is equal to given count. +interface: not + +```javascript +is.propertyCount({this: 'is', 'sample': object}, 2); +=> true + +is.propertyCount({this: 'is', 'sample': object}, 3); +=> false + +is.not.propertyCount({}, 2); +=> true +``` + +is.propertyDefined(value:object, property) +------------------------------------------ +####Checks if the given property is defined on object. +interface: not + +```javascript +is.propertyDefined({yeap: 'yeap'}, 'yeap'); +=> true + +is.propertyDefined({yeap: 'yeap'}, 'nope'); +=> false + +is.not.propertyDefined({}, 'nope'); +=> true +``` + +is.windowObject(value:window) +----------------------------- +####Checks if the given object is window object. +interfaces: not, all, any + +```javascript +is.windowObject(window); +=> true + +is.windowObject({nope: 'nope'}); +=> false + +is.not.windowObject({}); +=> true + +is.all.windowObject(window, {nope: 'nope'}); +=> false + +is.any.windowObject(window, {nope: 'nope'}); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.windowObject([window, {nope: 'nope'}]); +=> false +``` + +is.domNode(value:object) +----------------------------- +####Checks if the given object is a dom node. +interfaces: not, all, any + +```javascript +var obj = document.createElement('div'); +is.domNode(obj); +=> true + +is.domNode({nope: 'nope'}); +=> false + +is.not.domNode({}); +=> true + +is.all.domNode(obj, obj); +=> true + +is.any.domNode(obj, {nope: 'nope'}); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.domNode([obj, {nope: 'nope'}]); +=> false +``` + +Array checks +============ + +is.inArray(value:any, array) +--------------------- +####Checks if the given item is in array? +interface: not +```javascript +is.inArray(2, [1, 2, 3]); +=> true + +is.inArray(4, [1, 2, 3]); +=> false + +is.not.inArray(4, [1, 2, 3]); +=> true +``` + +is.sorted(value:array) +---------------------- +####Checks if the given array is sorted. +interfaces: not, all, any + +```javascript +is.sorted([1, 2, 3]); +=> true + +is.sorted([1, 2, 4, 3]); +=> false + +is.not.sorted([5, 4, 3]); +=> true + +is.all.sorted([1, 2], [3, 4]); +=> true + +is.any.sorted([1, 2], [5, 4]); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.sorted([[1, 2], [5, 4]]); +=> false +``` + +Environment checks +================== +####Environment checks are not available as node module. + +is.ie(value:number) +------------------- +####Checks if current browser is ie. Parameter is optional version number of browser. +interface: not + +```javascript +is.ie(); +=> true if current browser is ie + +is.ie(6); +=> hopefully false + +is.not.ie(); +=> false if current browser is ie +``` + +is.chrome() +----------- +####Checks if current browser is chrome. +interface: not + +```javascript +is.chrome(); +=> true if current browser is chrome + +is.not.chrome(); +=> false if current browser is chrome +``` + +is.firefox() +------------ +####Checks if current browser is firefox. +interface: not + +```javascript +is.firefox(); +=> true if current browser is firefox + +is.not.firefox(); +=> false if current browser is firefox +``` + +is.opera() +---------- +####Checks if current browser is opera. +interface: not + +```javascript +is.opera(); +=> true if current browser is opera + +is.not.opera(); +=> false if current browser is opera +``` + +is.safari() +----------- +####Checks if current browser is safari. +interface: not + +```javascript +is.safari(); +=> true if current browser is safari + +is.not.safari(); +=> false if current browser is safari +``` + +is.ios() +-------- +####Checks if current device has ios. +interface: not + +```javascript +is.ios(); +=> true if current device is iPhone, iPad or iPod + +is.not.ios(); +=> true if current device is not iPhone, iPad or iPod +``` + +is.iphone() +----------- +####Checks if current device is iPhone. +interface: not + +```javascript +is.iphone(); +=> true if current device is iPhone + +is.not.iphone(); +=> true if current device is not iPhone +``` + +is.ipad() +--------- +####Checks if current device is iPad. +interface: not + +```javascript +is.ipad(); +=> true if current device is iPad + +is.not.ipad(); +=> true if current device is not iPad +``` + +is.ipod() +--------- +####Checks if current device is iPod. +interface: not + +```javascript +is.ipod(); +=> true if current device is iPod + +is.not.ipod(); +=> true if current device is not iPod +``` + +is.android() +------------ +####Checks if current device has Android. +interface: not + +```javascript +is.android(); +=> true if current device has Android OS + +is.not.android(); +=> true if current device has not Android OS +``` + +is.androidPhone() +----------------- +####Checks if current device is Android phone. +interface: not + +```javascript +is.androidPhone(); +=> true if current device is Android phone + +is.not.androidPhone(); +=> true if current device is not Android phone +``` + +is.androidTablet() +------------------ +####Checks if current device is Android tablet. +interface: not + +```javascript +is.androidTablet(); +=> true if current device is Android tablet + +is.not.androidTablet(); +=> true if current device is not Android tablet +``` + +is.blackberry() +--------------- +####Checks if current device is Blackberry. +interface: not + +```javascript +is.blackberry(); +=> true if current device is Blackberry + +is.not.blackberry(); +=> true if current device is not Blackberry +``` + +is.windowsPhone() +----------------- +####Checks if current device is Windows phone. +interface: not + +```javascript +is.windowsPhone(); +=> true if current device is Windows phone + +is.not.windowsPhone(); +=> true if current device is not Windows Phone +``` + +is.windowsTablet() +------------------ +####Checks if current device is Windows tablet. +interface: not + +```javascript +is.windowsTablet(); +=> true if current device is Windows tablet + +is.not.windowsTablet(); +=> true if current device is not Windows tablet +``` + +is.windows() +------------ +####Checks if current OS is Windows. +interface: not + +```javascript +is.windows(); +=> true if current OS is Windows + +is.not.windows(); +=> true if current OS is not Windows +``` + +is.mac() +-------- +####Checks if current OS is Mac OS X. +interface: not + +```javascript +is.mac(); +=> true if current OS is Mac OS X + +is.not.mac(); +=> true if current OS is not Mac OS X +``` + +is.linux() +---------- +####Checks if current OS is linux. +interface: not + +```javascript +is.linux(); +=> true if current OS is linux + +is.not.linux(); +=> true if current OS is not linux +``` + +is.desktop() +------------ +####Checks if current device is desktop. +interface: not + +```javascript +is.desktop(); +=> true if current device is desktop + +is.not.desktop(); +=> true if current device is not desktop +``` + +is.mobile() +----------- +####Checks if current device is mobile. +interface: not +iPhone, iPod, Android Phone, Windows Phone, Blackberry. +```javascript + +is.mobile(); +=> true if current device is mobile + +is.not.mobile(); +=> true if current device is not mobile +``` + +is.tablet() +----------- +####Checks if current device is tablet. +interface: not +iPad, Android Tablet, Windows Tablet +```javascript + +is.tablet(); +=> true if current device is tablet + +is.not.tablet(); +=> true if current device is not tablet +``` + +is.online() +----------- +####Checks if current device is online. +interface: not + +```javascript +is.online(); +=> true if current device is online + +is.not.online(); +=> true if current device is not online +``` + +is.offline() +------------ +####Checks if current device is offline. +interface: not + +```javascript +is.offline(); +=> true if current device is offline + +is.not.offline(); +=> true if current device is not offline +``` + +Time checks +=========== + +is.today(value:object) +---------------------- +####Checks if the given date object indicate today. +interfaces: not, all, any + +```javascript +var today = new Date(); +is.today(today); +=> true + +var yesterday = new Date(new Date().setDate(new Date().getDate() - 1)); +is.today(yesterday); +=> false + +is.not.today(yesterday); +=> true + +is.all.today(today, today); +=> true + +is.any.today(today, yesterday); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.today([today, yesterday]); +=> false +``` + +is.yesterday(value:object) +-------------------------- +####Checks if the given date object indicate yesterday. +interfaces: not, all, any + +```javascript +var today = new Date(); +is.yesterday(today); +=> false + +var yesterday = new Date(new Date().setDate(new Date().getDate() - 1)); +is.yesterday(yesterday); +=> true + +is.not.yesterday(today); +=> true + +is.all.yesterday(yesterday, today); +=> false + +is.any.yesterday(today, yesterday); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.yesterday([today, yesterday]); +=> false +``` + +is.tomorrow(value:object) +------------------------- +####Checks if the given date object indicate tomorrow. +interfaces: not, all, any + +```javascript +var today = new Date(); +is.tomorrow(today); +=> false + +var tomorrow = new Date(new Date().setDate(new Date().getDate() + 1)); +is.tomorrow(tomorrow); +=> true + +is.not.tomorrow(today); +=> true + +is.all.tomorrow(tomorrow, today); +=> false + +is.any.tomorrow(today, tomorrow); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.tomorrow([today, tomorrow]); +=> false +``` + +is.past(value:object) +--------------------- +####Checks if the given date object indicate past. +interfaces: not, all, any + +```javascript +var yesterday = new Date(new Date().setDate(new Date().getDate() - 1)); +var tomorrow = new Date(new Date().setDate(new Date().getDate() + 1)); + +is.past(yesterday); +=> true + +is.past(tomorrow); +=> false + +is.not.past(tomorrow); +=> true + +is.all.past(tomorrow, yesterday); +=> false + +is.any.past(yesterday, tomorrow); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.past([yesterday, tomorrow]); +=> false +``` + +is.future(value:object) +----------------------- +####Checks if the given date object indicate future. +interfaces: not, all, any + +```javascript +var yesterday = new Date(new Date().setDate(new Date().getDate() - 1)); +var tomorrow = new Date(new Date().setDate(new Date().getDate() + 1)); + +is.future(yesterday); +=> false + +is.future(tomorrow); +=> true + +is.not.future(yesterday); +=> true + +is.all.future(tomorrow, yesterday); +=> false + +is.any.future(yesterday, tomorrow); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.future([yesterday, tomorrow]); +=> false +``` + +is.day(value:object, dayString) +------------------------------- +####Checks if the given date objects' day equal given dayString parameter. +interface: not + +```javascript +var mondayObj = new Date('01/26/2015'); +var tuesdayObj = new Date('01/27/2015'); +is.day(mondayObj, 'monday'); +=> true + +is.day(mondayObj, 'tuesday'); +=> false + +is.not.day(mondayObj, 'tuesday'); +=> true +``` + +is.month(value:object, monthString) +----------------------------------- +####Checks if the given date objects' month equal given monthString parameter. +interface: not + +```javascript +var januaryObj = new Date('01/26/2015'); +var februaryObj = new Date('02/26/2015'); +is.month(januaryObj, 'january'); +=> true + +is.month(februaryObj, 'january'); +=> false + +is.not.month(februaryObj, 'january'); +=> true +``` + +is.year(value:object, yearNumber) +--------------------------------- +####Checks if the given date objects' year equal given yearNumber parameter. +interface: not + +```javascript +var year2015 = new Date('01/26/2015'); +var year2016 = new Date('01/26/2016'); +is.year(year2015, 2015); +=> true + +is.year(year2016, 2015); +=> false + +is.not.year(year2016, 2015); +=> true +``` + +is.leapYear(value:number) +--------------------------------- +####Checks if the given year number is a leap year +interfaces: not, all, any + +```javascript +is.leapYear(2016); +=> true + +is.leapYear(2015); +=> false + +is.not.leapYear(2015); +=> true + +is.all.leapYear(2015, 2016); +=> false + +is.any.leapYear(2015, 2016); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.leapYear([2016, 2080]); +=> true +``` + +is.weekend(value:object) +------------------------ +####Checks if the given date objects' day is weekend. +interfaces: not, all, any + +```javascript +var monday = new Date('01/26/2015'); +var sunday = new Date('01/25/2015'); +var saturday = new Date('01/24/2015'); +is.weekend(sunday); +=> true + +is.weekend(monday); +=> false + +is.not.weekend(monday); +=> true + +is.all.weekend(sunday, saturday); +=> true + +is.any.weekend(sunday, saturday, monday); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.weekend([sunday, saturday, monday]); +=> false +``` + +is.weekday(value:object) +------------------------ +####Checks if the given date objects' day is weekday. +interfaces: not, all, any + +```javascript +var monday = new Date('01/26/2015'); +var sunday = new Date('01/25/2015'); +var saturday = new Date('01/24/2015'); +is.weekday(monday); +=> true + +is.weekday(sunday); +=> false + +is.not.weekday(sunday); +=> true + +is.all.weekday(monday, saturday); +=> false + +is.any.weekday(sunday, saturday, monday); +=> true + +// 'all' and 'any' interfaces can also take array parameter +is.all.weekday([sunday, saturday, monday]); +=> false +``` + +is.inDateRange(value:object, startObject, endObject) +---------------------------------------------------- +####Checks if date is within given range. +interface: not + +```javascript +var saturday = new Date('01/24/2015'); +var sunday = new Date('01/25/2015'); +var monday = new Date('01/26/2015'); +is.inDateRange(sunday, saturday, monday); +=> true + +is.inDateRange(saturday, sunday, monday); +=> false + +is.not.inDateRange(saturday, sunday, monday); +=> true +``` + +is.inLastWeek(value:object) +--------------------------- +####Checks if the given date is between now and 7 days ago. +interface: not + +```javascript +var twoDaysAgo = new Date(new Date().setDate(new Date().getDate() - 2)); +var nineDaysAgo = new Date(new Date().setDate(new Date().getDate() - 9)); +is.inLastWeek(twoDaysAgo); +=> true + +is.inLastWeek(nineDaysAgo); +=> false + +is.not.inLastWeek(nineDaysAgo); +=> true +``` + +is.inLastMonth(value:object) +---------------------------- +####Checks if the given date is between now and a month ago. +interface: not + +```javascript +var tenDaysAgo = new Date(new Date().setDate(new Date().getDate() - 10)); +var fortyDaysAgo = new Date(new Date().setDate(new Date().getDate() - 40)); +is.inLastMonth(tenDaysAgo); +=> true + +is.inLastMonth(fortyDaysAgo); +=> false + +is.not.inLastMonth(fortyDaysAgo); +=> true +``` + +is.inLastYear(value:object) +--------------------------- +####Checks if the given date is between now and a year ago. +interface: not + +```javascript +var twoMonthsAgo = new Date(new Date().setMonth(new Date().getMonth() - 2)); +var thirteenMonthsAgo = new Date(new Date().setMonth(new Date().getMonth() - 13)); +is.inLastYear(twoMonthsAgo); +=> true + +is.inLastYear(thirteenMonthsAgo); +=> false + +is.not.inLastYear(thirteenMonthsAgo); +=> true +``` + +is.inNextWeek(value:object) +--------------------------- +####Checks if the given date is between now and 7 days later. +interface: not + +```javascript +var twoDaysLater = new Date(new Date().setDate(new Date().getDate() + 2)); +var nineDaysLater = new Date(new Date().setDate(new Date().getDate() + 9)); +is.inNextWeek(twoDaysLater); +=> true + +is.inNextWeek(nineDaysLater); +=> false + +is.not.inNextWeek(nineDaysLater); +=> true +``` + +is.inNextMonth(value:object) +---------------------------- +####Checks if the given date is between now and a month later. +interface: not + +```javascript +var tenDaysLater = new Date(new Date().setDate(new Date().getDate() + 10)); +var fortyDaysLater = new Date(new Date().setDate(new Date().getDate() + 40)); +is.inNextMonth(tenDaysLater); +=> true + +is.inNextMonth(fortyDaysLater); +=> false + +is.not.inNextMonth(fortyDaysLater); +=> true +``` + +is.inNextYear(value:object) +--------------------------- +####Checks if the given date is between now and a year later. +interface: not + +```javascript +var twoMonthsLater = new Date(new Date().setMonth(new Date().getMonth() + 2)); +var thirteenMonthsLater = new Date(new Date().setMonth(new Date().getMonth() + 13)); +is.inNextYear(twoMonthsLater); +=> true + +is.inNextYear(thirteenMonthsLater); +=> false + +is.not.inNextYear(thirteenMonthsLater); +=> true +``` + +is.quarterOfYear(value:object, quarterNumber) +--------------------------------------------- +####Checks if the given date is in the parameter quarter. +interface: not + +```javascript +var firstQuarter = new Date('01/26/2015'); +var secondQuarter = new Date('05/26/2015'); +is.quarterOfYear(firstQuarter, 1); +=> true + +is.quarterOfYear(secondQuarter, 1); +=> false + +is.not.quarterOfYear(secondQuarter, 1); +=> true +``` + +is.dayLightSavingTime(value:object, quarterNumber) +-------------------------------------------------- +####Checks if the given date is in daylight saving time. +interface: not + +```javascript +// For Turkey Time Zone +var january1 = new Date('01/01/2015'); +var june1 = new Date('06/01/2015'); + +is.dayLightSavingTime(june1); +=> true + +is.dayLightSavingTime(january1); +=> false + +is.not.dayLightSavingTime(january1); +=> true +``` + +Configuration methods +===================== + +is.setRegexp(value:RegExp, regexpString) +---------------------------------------- +Override RegExps if you think they suck. + +```javascript +is.url('https://www.duckduckgo.com'); +=> true + +is.setRegexp(/quack/, 'url'); +is.url('quack'); +=> true +``` + +is.setNamespace() +----------------- +Change namespace of library to prevent name collisions. + +```javascript +var customName = is.setNamespace(); +customName.odd(3); +=> true +``` diff --git a/vendors/is.js/bower.json b/vendors/is.js/bower.json new file mode 100644 index 000000000..3ab0941d0 --- /dev/null +++ b/vendors/is.js/bower.json @@ -0,0 +1,35 @@ +{ + "name": "is_js", + "main": "is.js", + "version": "0.6.0", + "homepage": "http://arasatasaygin.github.io/is.js/", + "authors": [ + "arasatasaygin " + ], + "description": "micro check library", + "moduleType": [ + "amd", + "globals", + "node" + ], + "keywords": [ + "type", + "presence", + "regexp", + "string", + "arithmetic", + "object", + "array", + "environment", + "time", + "configuration" + ], + "license": "MIT", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ] +} diff --git a/vendors/is.js/is.js b/vendors/is.js/is.js new file mode 100644 index 000000000..5c98e3298 --- /dev/null +++ b/vendors/is.js/is.js @@ -0,0 +1,818 @@ +// is.js 0.6.0 +// Author: Aras Atasaygin + +// AMD with global, Node, or global +;(function(root, factory) { + if(typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['is'], function(is) { + // Also create a global in case some scripts + // that are loaded still are looking for + // a global even when an AMD loader is in use. + return (root.is = factory(is)); + }); + } else if(typeof exports === 'object') { + // Node. Does not work with strict CommonJS, but + // only CommonJS-like enviroments that support module.exports, + // like Node. + module.exports = factory(require('is_js')); + } else { + // Browser globals (root is window) + root.is = factory(root.is); + } +}(this, function(is) { + + // Baseline + /* -------------------------------------------------------------------------- */ + + var root = this; + var previousIs = root.is; + + // define 'is' object and current version + is = {}; + is.VERSION = '0.6.0'; + + // define interfaces + is.not = {}; + is.all = {}; + is.any = {}; + + // cache some methods to call later on + var toString = Object.prototype.toString; + var arraySlice = Array.prototype.slice; + var hasOwnProperty = Object.prototype.hasOwnProperty; + + // helper function which reverses the sense of predicate result + function not(func) { + return function() { + return !func.apply(null, arraySlice.call(arguments)); + }; + } + + // helper function which call predicate function per parameter and return true if all pass + function all(func) { + return function() { + var parameters = arraySlice.call(arguments); + var length = parameters.length; + if(length === 1 && is.array(parameters[0])) { // support array + parameters = parameters[0]; + length = parameters.length; + } + for (var i = 0; i < length; i++) { + if (!func.call(null, parameters[i])) { + return false; + } + } + return true; + }; + } + + // helper function which call predicate function per parameter and return true if any pass + function any(func) { + return function() { + var parameters = arraySlice.call(arguments); + var length = parameters.length; + if(length === 1 && is.array(parameters[0])) { // support array + parameters = parameters[0]; + length = parameters.length; + } + for (var i = 0; i < length; i++) { + if (func.call(null, parameters[i])) { + return true; + } + } + return false; + }; + } + + // Type checks + /* -------------------------------------------------------------------------- */ + + // is a given value Arguments? + is.arguments = function(value) { // fallback check is for IE + return is.not.null(value) && (toString.call(value) === '[object Arguments]' || (typeof value === 'object' && 'callee' in value)); + }; + + // is a given value Array? + is.array = Array.isArray || function(value) { // check native isArray first + return toString.call(value) === '[object Array]'; + }; + + // is a given value Boolean? + is.boolean = function(value) { + return value === true || value === false || toString.call(value) === '[object Boolean]'; + }; + + // is a given value Date Object? + is.date = function(value) { + return toString.call(value) === '[object Date]'; + }; + + // is a given value Error object? + is.error = function(value) { + return toString.call(value) === '[object Error]'; + }; + + // is a given value function? + is.function = function(value) { // fallback check is for IE + return toString.call(value) === '[object Function]' || typeof value === 'function'; + }; + + // is a given value NaN? + is.nan = function(value) { // NaN is number :) Also it is the only value which does not equal itself + return value !== value; + }; + + // is a given value null? + is.null = function(value) { + return value === null || toString.call(value) === '[object Null]'; + }; + + // is a given value number? + is.number = function(value) { + return toString.call(value) === '[object Number]'; + }; + + // is a given value object? + is.object = function(value) { + var type = typeof value; + return type === 'function' || type === 'object' && !!value; + }; + + // is given value a pure JSON object? + is.json = function(value) { + return toString.call(value) === '[object Object]'; + }; + + // is a given value RegExp? + is.regexp = function(value) { + return toString.call(value) === '[object RegExp]'; + }; + + // are given values same type? + // prevent NaN, Number same type check + is.sameType = function(value1, value2) { + if(is.nan(value1) || is.nan(value2)) { + return is.nan(value1) === is.nan(value2); + } + return toString.call(value1) === toString.call(value2); + }; + // sameType method does not support 'all' and 'any' interfaces + is.sameType.api = ['not']; + + // is a given value String? + is.string = function(value) { + return toString.call(value) === '[object String]'; + }; + + // is a given value Char? + is.char = function(value) { + return is.string(value) && value.length === 1; + }; + + // is a given value undefined? + is.undefined = function(value) { + return value === void 0; + }; + + // Presence checks + /* -------------------------------------------------------------------------- */ + + //is a given value empty? Objects, arrays, strings + is.empty = function(value) { + if(is.object(value)){ + var num = Object.getOwnPropertyNames(value).length; + if(num === 0 || (num === 1 && is.array(value)) || (num === 2 && is.arguments(value))){ + return true; + } + return false; + } else { + return value === ''; + } + }; + + // is a given value existy? + is.existy = function(value) { + return value !== null && value !== undefined; + }; + + // is a given value truthy? + is.truthy = function(value) { + return is.existy(value) && value !== false && is.not.nan(value) && value !== "" && value !== 0; + }; + + // is a given value falsy? + is.falsy = not(is.truthy); + + // is a given value space? + // horizantal tab: 9, line feed: 10, vertical tab: 11, form feed: 12, carriage return: 13, space: 32 + is.space = function(value) { + if(is.char(value)) { + var characterCode = value.charCodeAt(0); + return (characterCode > 8 && characterCode < 14) || characterCode === 32; + } else { + return false; + } + }; + + // Arithmetic checks + /* -------------------------------------------------------------------------- */ + + // are given values equal? supports numbers, strings, regexps, booleans + // TODO: Add object and array support + is.equal = function(value1, value2) { + // check 0 and -0 equity with Infinity and -Infinity + if(is.all.number(value1, value2)) { + return value1 === value2 && 1 / value1 === 1 / value2; + } + // check regexps as strings too + if(is.all.string(value1, value2) || is.all.regexp(value1, value2)) { + return '' + value1 === '' + value2; + } + if(is.all.boolean(value1, value2)) { + return value1 === value2; + } + return false; + }; + // equal method does not support 'all' and 'any' interfaces + is.equal.api = ['not']; + + // is a given number even? + is.even = function(numb) { + return is.number(numb) && numb % 2 === 0; + }; + + // is a given number odd? + is.odd = function(numb) { + return is.number(numb) && numb % 2 !== 0; + }; + + // is a given number positive? + is.positive = function(numb) { + return is.number(numb) && numb > 0; + }; + + // is a given number negative? + is.negative = function(numb) { + return is.number(numb) && numb < 0; + }; + + // is a given number above minimum parameter? + is.above = function(numb, min) { + return is.all.number(numb, min) && numb > min; + }; + // above method does not support 'all' and 'any' interfaces + is.above.api = ['not']; + + // is a given number above maximum parameter? + is.under = function(numb, max) { + return is.all.number(numb, max) && numb < max; + }; + // least method does not support 'all' and 'any' interfaces + is.under.api = ['not']; + + // is a given number within minimum and maximum parameters? + is.within = function(numb, min, max) { + return is.all.number(numb, min, max) && numb > min && numb < max; + }; + // within method does not support 'all' and 'any' interfaces + is.within.api = ['not']; + + // is a given number decimal? + is.decimal = function(numb) { + return is.number(numb) && numb % 1 !== 0; + }; + + // is a given number integer? + is.integer = function(numb) { + return is.number(numb) && numb % 1 === 0; + }; + + // is a given number finite? + is.finite = isFinite || function(numb) { + return numb !== Infinity && numb !== -Infinity && is.not.nan(numb); + }; + + // is a given number infinite? + is.infinite = not(is.finite); + + // Regexp checks + /* -------------------------------------------------------------------------- */ + // Steven Levithan, Jan Goyvaerts: Regular Expressions Cookbook + // Scott Gonzalez: Email address validation + + // eppPhone match extensible provisioning protocol format + // nanpPhone match north american number plan format + // dateString match m/d/yy and mm/dd/yyyy, allowing any combination of one or two digits for the day and month, and two or four digits for the year + // time match hours, minutes, and seconds, 24-hour clock + var regexps = { + 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]\s?[0-9][A-Z][0-9]$/, + ukPostCode: /^[A-Z]{1,2}[0-9RCHNQ][0-9A-Z]?\s?[0-9][ABD-HJLNP-UW-Z]{2}$|^[A-Z]{2}-?[0-9]{4}$/, + 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)?)$/, + hexadecimal: /^[0-9a-fA-F]+$/, + hexColor: /^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/, + ipv4: /^(?:(?:\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])\.){3}(?:\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])$/, + ipv6: /^(([a-zA-Z]|[a-zA-Z][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9])$|^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/, + ip: /^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^(([a-zA-Z]|[a-zA-Z][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9])$|^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/ + }; + + // create regexp checks methods from 'regexp' object + for(var regexp in regexps) { + if(regexps.hasOwnProperty(regexp)) { + regexpCheck(regexp, regexps); + } + } + + function regexpCheck(regexp, regexps) { + is[regexp] = function(value) { + return regexps[regexp].test(value); + }; + } + + // String checks + /* -------------------------------------------------------------------------- */ + + // is a given string include parameter substring? + is.include = String.prototype.includes || function(str, substr) { + return str.indexOf(substr) > -1; + }; + // include method does not support 'all' and 'any' interfaces + is.include.api = ['not']; + + // is a given string all uppercase? + is.upperCase = function(str) { + return is.string(str) && str === str.toUpperCase(); + }; + + // is a given string all lowercase? + is.lowerCase = function(str) { + return is.string(str) && str === str.toLowerCase(); + }; + + // is string start with a given startWith parameter? + is.startWith = function(str, startWith) { + return is.string(str) && str.indexOf(startWith) === 0; + }; + // startWith method does not support 'all' and 'any' interfaces + is.startWith.api = ['not']; + + // is string end with a given endWith parameter? + is.endWith = function(str, endWith) { + return is.string(str) && str.indexOf(endWith) > -1 && str.indexOf(endWith) === str.length - endWith.length; + }; + // endWith method does not support 'all' and 'any' interfaces + is.endWith.api = ['not']; + + // is a given string or sentence capitalized? + is.capitalized = function(str) { + if(is.not.string(str)) { + return false; + } + var words = str.split(' '); + var capitalized = []; + for(var i = 0; i < words.length; i++) { + capitalized.push(words[i][0] === words[i][0].toUpperCase()); + } + return is.all.truthy.apply(null, capitalized); + }; + + // is a given string palindrome? + is.palindrome = function(str) { + return is.string(str) && str == str.split('').reverse().join(''); + }; + + // Time checks + /* -------------------------------------------------------------------------- */ + + var days = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday']; + var months = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december']; + + // is a given date indicate today? + is.today = function(obj) { + var now = new Date(); + var todayString = now.toDateString(); + return is.date(obj) && obj.toDateString() === todayString; + }; + + // is a given date indicate yesterday? + is.yesterday = function(obj) { + var now = new Date(); + var yesterdayString = new Date(now.setDate(now.getDate() - 1)).toDateString(); + return is.date(obj) && obj.toDateString() === yesterdayString; + }; + + // is a given date indicate tomorrow? + is.tomorrow = function(obj) { + var now = new Date(); + var tomorrowString = new Date(now.setDate(now.getDate() + 1)).toDateString(); + return is.date(obj) && obj.toDateString() === tomorrowString; + }; + + // is a given date past? + is.past = function(obj) { + var now = new Date(); + return is.date(obj) && obj.getTime() < now.getTime(); + }; + + // is a given date future? + is.future = not(is.past); + + // is a given dates day equal given dayString parameter? + is.day = function(obj, dayString) { + return is.date(obj) && dayString.toLowerCase() === days[obj.getDay()]; + }; + // day method does not support 'all' and 'any' interfaces + is.day.api = ['not']; + + // is a given dates month equal given monthString parameter? + is.month = function(obj, monthString) { + return is.date(obj) && monthString.toLowerCase() === months[obj.getMonth()]; + }; + // month method does not support 'all' and 'any' interfaces + is.month.api = ['not']; + + // is a given dates year equal given year parameter? + is.year = function(obj, year) { + return is.date(obj) && is.number(year) && year === obj.getFullYear(); + }; + // year method does not support 'all' and 'any' interfaces + is.year.api = ['not']; + + // is the given year a leap year? + is.leapYear = function(year) { + return is.number(year) && ((year % 4 === 0 && year % 100 !== 0) || year % 400 === 0); + }; + + // is a given date weekend? + // 6: Saturday, 0: Sunday + is.weekend = function(obj) { + return is.date(obj) && (obj.getDay() === 6 || obj.getDay() === 0); + }; + + // is a given date weekday? + is.weekday = not(is.weekend); + + // is date within given range? + is.inDateRange = function(obj, startObj, endObj) { + if(is.not.date(obj) || is.not.date(startObj) || is.not.date(endObj)) { + return false; + } + var givenDate = obj.getTime(); + var start = startObj.getTime(); + var end = endObj.getTime(); + return givenDate > start && givenDate < end; + }; + // inDateRange method does not support 'all' and 'any' interfaces + is.inDateRange.api = ['not']; + + // is a given date in last week range? + is.inLastWeek = function(obj) { + return is.inDateRange(obj, new Date(new Date().setDate(new Date().getDate() - 7)), new Date()); + }; + + // is a given date in last month range? + is.inLastMonth = function(obj) { + return is.inDateRange(obj, new Date(new Date().setMonth(new Date().getMonth() - 1)), new Date()); + }; + + // is a given date in last year range? + is.inLastYear = function(obj) { + return is.inDateRange(obj, new Date(new Date().setFullYear(new Date().getFullYear() - 1)), new Date()); + }; + + // is a given date in next week range? + is.inNextWeek = function(obj) { + return is.inDateRange(obj, new Date(), new Date(new Date().setDate(new Date().getDate() + 7))); + }; + + // is a given date in next month range? + is.inNextMonth = function(obj) { + return is.inDateRange(obj, new Date(), new Date(new Date().setMonth(new Date().getMonth() + 1))); + }; + + // is a given date in next year range? + is.inNextYear = function(obj) { + return is.inDateRange(obj, new Date(), new Date(new Date().setFullYear(new Date().getFullYear() + 1))); + }; + + // is a given date in the parameter quarter? + is.quarterOfYear = function(obj, quarterNumber) { + return is.date(obj) && is.number(quarterNumber) && quarterNumber === Math.floor((obj.getMonth() + 3) / 3); + }; + // quarterOfYear method does not support 'all' and 'any' interfaces + is.quarterOfYear.api = ['not']; + + // is a given date in daylight saving time? + is.dayLightSavingTime = function(obj) { + var january = new Date(obj.getFullYear(), 0, 1); + var july = new Date(obj.getFullYear(), 6, 1); + var stdTimezoneOffset = Math.max(january.getTimezoneOffset(), july.getTimezoneOffset()); + return obj.getTimezoneOffset() < stdTimezoneOffset; + }; + + // Environment checks + /* -------------------------------------------------------------------------- */ + + // check if library is used as a Node.js module + if(typeof window !== 'undefined') { + + // store navigator properties to use later + var userAgent = 'navigator' in window && 'userAgent' in navigator && navigator.userAgent.toLowerCase() || ''; + var vendor = 'navigator' in window && 'vendor' in navigator && navigator.vendor.toLowerCase() || ''; + var appVersion = 'navigator' in window && 'appVersion' in navigator && navigator.appVersion.toLowerCase() || ''; + + // is current browser chrome? + is.chrome = function() { + return /chrome|chromium/i.test(userAgent) && /google inc/.test(vendor); + }; + // chrome method does not support 'all' and 'any' interfaces + is.chrome.api = ['not']; + + // is current browser firefox? + is.firefox = function() { + return /firefox/i.test(userAgent); + }; + // firefox method does not support 'all' and 'any' interfaces + is.firefox.api = ['not']; + + // is current browser internet explorer? + // parameter is optional + is.ie = function(version) { + if(!version) { + return /msie/i.test(userAgent) || "ActiveXObject" in window; + } + if(version >= 11) { + return "ActiveXObject" in window; + } + return new RegExp('msie ' + version).test(userAgent); + }; + // ie method does not support 'all' and 'any' interfaces + is.ie.api = ['not']; + + // is current browser opera? + is.opera = function() { + return /^Opera\//.test(userAgent) || // Opera 12 and older versions + /\x20OPR\//.test(userAgent); // Opera 15+ + }; + // opera method does not support 'all' and 'any' interfaces + is.opera.api = ['not']; + + // is current browser safari? + is.safari = function() { + return /safari/i.test(userAgent) && /apple computer/i.test(vendor); + }; + // safari method does not support 'all' and 'any' interfaces + is.safari.api = ['not']; + + // is current device ios? + is.ios = function() { + return is.iphone() || is.ipad() || is.ipod(); + }; + // ios method does not support 'all' and 'any' interfaces + is.ios.api = ['not']; + + // is current device iphone? + is.iphone = function() { + return /iphone/i.test(userAgent); + }; + // iphone method does not support 'all' and 'any' interfaces + is.iphone.api = ['not']; + + // is current device ipad? + is.ipad = function() { + return /ipad/i.test(userAgent); + }; + // ipad method does not support 'all' and 'any' interfaces + is.ipad.api = ['not']; + + // is current device ipod? + is.ipod = function() { + return /ipod/i.test(userAgent); + }; + // ipod method does not support 'all' and 'any' interfaces + is.ipod.api = ['not']; + + // is current device android? + is.android = function() { + return /android/i.test(userAgent); + }; + // android method does not support 'all' and 'any' interfaces + is.android.api = ['not']; + + // is current device android phone? + is.androidPhone = function() { + return /android/i.test(userAgent) && /mobile/i.test(userAgent); + }; + // androidPhone method does not support 'all' and 'any' interfaces + is.androidPhone.api = ['not']; + + // is current device android tablet? + is.androidTablet = function() { + return /android/i.test(userAgent) && !/mobile/i.test(userAgent); + }; + // androidTablet method does not support 'all' and 'any' interfaces + is.androidTablet.api = ['not']; + + // is current device blackberry? + is.blackberry = function() { + return /blackberry/i.test(userAgent); + }; + // blackberry method does not support 'all' and 'any' interfaces + is.blackberry.api = ['not']; + + // is current device desktop? + is.desktop = function() { + return is.not.mobile() && is.not.tablet(); + }; + // desktop method does not support 'all' and 'any' interfaces + is.desktop.api = ['not']; + + // is current operating system linux? + is.linux = function() { + return /linux/i.test(appVersion); + }; + // linux method does not support 'all' and 'any' interfaces + is.linux.api = ['not']; + + // is current operating system mac? + is.mac = function() { + return /mac/i.test(appVersion); + }; + // mac method does not support 'all' and 'any' interfaces + is.mac.api = ['not']; + + // is current operating system windows? + is.windows = function() { + return /win/i.test(appVersion); + }; + // windows method does not support 'all' and 'any' interfaces + is.windows.api = ['not']; + + // is current device windows phone? + is.windowsPhone = function() { + return is.windows() && /phone/i.test(userAgent); + }; + // windowsPhone method does not support 'all' and 'any' interfaces + is.windowsPhone.api = ['not']; + + // is current device windows tablet? + is.windowsTablet = function() { + return is.windows() && is.not.windowsPhone() && /touch/i.test(userAgent); + }; + // windowsTablet method does not support 'all' and 'any' interfaces + is.windowsTablet.api = ['not']; + + // is current device mobile? + is.mobile = function() { + return is.iphone() || is.ipod() || is.androidPhone() || is.blackberry() || is.windowsPhone(); + }; + // mobile method does not support 'all' and 'any' interfaces + is.mobile.api = ['not']; + + // is current device tablet? + is.tablet = function() { + return is.ipad() || is.androidTablet() || is.windowsTablet(); + }; + // tablet method does not support 'all' and 'any' interfaces + is.tablet.api = ['not']; + + // is current state online? + is.online = function() { + return navigator.onLine; + }; + // online method does not support 'all' and 'any' interfaces + is.online.api = ['not']; + + // is current state offline? + is.offline = not(is.online); + // offline method does not support 'all' and 'any' interfaces + is.offline.api = ['not']; + } + + // Object checks + /* -------------------------------------------------------------------------- */ + + // has a given object got parameterized count property? + is.propertyCount = function(obj, count) { + if(!is.object(obj) || !is.number(count)) { + return false; + } + if(Object.keys) { + return Object.keys(obj).length === count; + } + var properties = [], + property; + for(property in obj) { + if (hasOwnProperty.call(obj, property)) { + properties.push(property); + } + } + return properties.length === count; + }; + // propertyCount method does not support 'all' and 'any' interfaces + is.propertyCount.api = ['not']; + + // is given object has parameterized property? + is.propertyDefined = function(obj, property) { + return is.object(obj) && is.string(property) && property in obj; + }; + // propertyDefined method does not support 'all' and 'any' interfaces + is.propertyDefined.api = ['not']; + + // is a given object window? + // setInterval method is only available for window object + is.windowObject = function(obj) { + return typeof obj === 'object' && 'setInterval' in obj; + }; + + // is a given object a DOM node? + is.domNode = function(obj) { + return is.object(obj) && obj.nodeType > 0; + }; + + // Array checks + /* -------------------------------------------------------------------------- */ + + // is a given item in an array? + is.inArray = function(val, arr){ + if(is.not.array(arr)) { + return false; + } + for(var i = 0; i < arr.length; i++) { + if (arr[i] === val) return true; + } + return false; + }; + // inArray method does not support 'all' and 'any' interfaces + is.inArray.api = ['not']; + + // is a given array sorted? + is.sorted = function(arr) { + if(is.not.array(arr)) { + return false; + } + for(var i = 0; i < arr.length; i++) { + if(arr[i] > arr[i + 1]) return false; + } + return true; + }; + + // API + // Set 'not', 'all' and 'any' interfaces to methods based on their api property + /* -------------------------------------------------------------------------- */ + + function setInterfaces() { + var options = is; + for(var option in options) { + if(hasOwnProperty.call(options, option) && is.function(options[option])) { + var interfaces = options[option].api || ['not', 'all', 'any']; + for (var i = 0; i < interfaces.length; i++) { + if(interfaces[i] === 'not') { + is.not[option] = not(is[option]); + } + if(interfaces[i] === 'all') { + is.all[option] = all(is[option]); + } + if(interfaces[i] === 'any') { + is.any[option] = any(is[option]); + } + } + } + } + } + setInterfaces(); + + // Configuration methods + // Intentionally added after setInterfaces function + /* -------------------------------------------------------------------------- */ + + // set optional regexps to methods if you think they suck + is.setRegexp = function(regexp, regexpName) { + for(var r in regexps) { + if(hasOwnProperty.call(regexps, r) && (regexpName === r)) { + regexps[r] = regexp; + } + } + }; + + // change namespace of library to prevent name collisions + // var preferredName = is.setNamespace(); + // preferredName.odd(3); + // => true + is.setNamespace = function() { + root.is = previousIs; + return this; + }; + + return is; +})); diff --git a/vendors/is.js/is.min.js b/vendors/is.js/is.min.js new file mode 100644 index 000000000..3aa617a79 --- /dev/null +++ b/vendors/is.js/is.min.js @@ -0,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=0;d>e;e++)if(!b.call(null,c[e]))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=0;d>e;e++)if(b.call(null,c[e]))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;h8&&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]\s?[0-9][A-Z][0-9]$/,ukPostCode:/^[A-Z]{1,2}[0-9RCHNQ][0-9A-Z]?\s?[0-9][ABD-HJLNP-UW-Z]{2}$|^[A-Z]{2}-?[0-9]{4}$/,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)?)$/,hexadecimal:/^[0-9a-fA-F]+$/,hexColor:/^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/,ipv4:/^(?:(?:\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])\.){3}(?:\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])$/,ipv6:/^(([a-zA-Z]|[a-zA-Z][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9])$|^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,ip:/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^(([a-zA-Z]|[a-zA-Z][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9])$|^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/};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)>-1&&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;ef&&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()=11?"ActiveXObject"in window:new RegExp("msie "+a).test(p):/msie/i.test(p)||"ActiveXObject"in window},a.ie.api=["not"],a.opera=function(){return/^Opera\//.test(p)||/\x20OPR\//.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.domNode=function(b){return a.object(b)&&b.nodeType>0},a.inArray=function(b,c){if(a.not.array(c))return!1;for(var d=0;db[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}); \ No newline at end of file diff --git a/vendors/is.js/package.json b/vendors/is.js/package.json new file mode 100644 index 000000000..d179a84c7 --- /dev/null +++ b/vendors/is.js/package.json @@ -0,0 +1,12 @@ +{ + "name": "is_js", + "version": "0.6.0", + "main": "is.js", + "license": "MIT", + "devDependencies": { + "grunt": "~0.4.5", + "grunt-contrib-jshint": "~0.10.0", + "grunt-contrib-uglify": "~0.5.0", + "grunt-mocha-phantomjs": "0.6.0" + } +} diff --git a/webpack.config.js b/webpack.config.js index e6300ec27..fb232d6b8 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -42,6 +42,7 @@ module.exports = { 'ssm': 'window.ssm', 'key': 'window.key', '_': 'window._', + 'is': 'window.is', '$': 'window.jQuery' } }; \ No newline at end of file