Checks if the given value type is arguments.
var getArguments = function() { return arguments;};var arguments = getArguments();is.arguments(arguments);=> trueis.not.arguments({foo: 'bar'});=> trueis.all.arguments(arguments, 'bar');=> falseis.any.arguments(['foo'], arguments);=> true// 'all' and 'any' interfaces can also take array parameteris.all.arguments([arguments, 'foo', 'bar']);=> false
Checks if the given value type is array.
is.array(['foo', 'bar', 'baz']);=> trueis.not.array({foo: 'bar'});=> trueis.all.array(['foo'], 'bar');=> falseis.any.array(['foo'], 'bar');=> true// 'all' and 'any' interfaces can also take array parameteris.all.array([[1, 2], 'foo', 'bar']);=> false
Checks if the given value type is boolean.
is.boolean(true);=> trueis.not.boolean({foo: 'bar'});=> trueis.all.boolean(true, 'bar');=> falseis.any.boolean(true, 'bar');=> true// 'all' and 'any' interfaces can also take array parameteris.all.boolean([true, 'foo', 'bar']);=> false
Checks if the given value type is date.
is.date(new Date());=> trueis.not.date({foo: 'bar'});=> trueis.all.date(new Date(), 'bar');=> falseis.any.date(new Date(), 'bar');=> true// 'all' and 'any' interfaces can also take array parameteris.all.date([new Date(), 'foo', 'bar']);=> false
Checks if the given value type is error.
is.error(new Error());=> trueis.not.error({foo: 'bar'});=> trueis.all.error(new Error(), 'bar');=> falseis.any.error(new Error(), 'bar');=> true// 'all' and 'any' interfaces can also take array parameteris.all.error([new Error(), 'foo', 'bar']);=> false
Checks if the given value type is function.
is.function(toString);=> trueis.not.function({foo: 'bar'});=> trueis.all.function(toString, 'bar');=> falseis.any.function(toString, 'bar');=> true// 'all' and 'any' interfaces can also take array parameteris.all.function([toString, 'foo', 'bar']);=> false
Checks if the given value type is NaN.
is.nan(NaN);=> trueis.not.nan(42);=> trueis.all.nan(NaN, 1);=> falseis.any.nan(NaN, 2);=> true// 'all' and 'any' interfaces can also take array parameteris.all.nan([NaN, 'foo', 1]);=> false
Checks if the given value type is null.
is.null(null);=> trueis.not.null(42);=> trueis.all.null(null, 1);=> falseis.any.null(null, 2);=> true// 'all' and 'any' interfaces can also take array parameteris.all.null([null, 'foo', 1]);=> false
Checks if the given value type is number.
is.number(42);=> trueis.number(NaN);=> falseis.not.number('42');=> trueis.all.number('foo', 1);=> falseis.any.number({}, 2);=> true// 'all' and 'any' interfaces can also take array parameteris.all.number([42, 'foo', 1]);=> false
Checks if the given value type is object.
is.object({foo: 'bar'});=> true// functions are also returnin as trueis.object(toString);=> trueis.not.object('foo');=> trueis.all.object({}, 1);=> falseis.any.object({}, 2);=> true// 'all' and 'any' interfaces can also take array parameteris.all.object([{}, new Object()]);=> true
Checks if the given value type is pure json object.
is.json({foo: 'bar'});=> true// functions are returning as falseis.json(toString);=> falseis.not.json([]);=> trueis.all.json({}, 1);=> falseis.any.json({}, 2);=> true// 'all' and 'any' interfaces can also take array parameteris.all.json([{}, {foo: 'bar'}]);=> true
Checks if the given value type is RegExp.
is.regexp(/test/);=> trueis.not.regexp(['foo']);=> trueis.all.regexp(/test/, 1);=> falseis.any.regexp(new RegExp('ab+c'), 2);=> true// 'all' and 'any' interfaces can also take array parameteris.all.regexp([{}, /test/]);=> false
Checks if the given value type is string.
is.string('foo');=> trueis.not.string(['foo']);=> trueis.all.string('foo', 1);=> falseis.any.string('foo', 2);=> true// 'all' and 'any' interfaces can also take array parameteris.all.string([{}, 'foo']);=> false
Checks if the given value type is char.
is.char('f');=> trueis.not.char(['foo']);=> trueis.all.char('f', 1);=> falseis.any.char('f', 2);=> true// 'all' and 'any' interfaces can also take array parameteris.all.char(['f', 'o', 'o']);=> true
Checks if the given value type is undefined.
is.undefined(undefined);=> trueis.not.undefined(null);=> trueis.all.undefined(undefined, 1);=> falseis.any.undefined(undefined, 2);=> true// 'all' and 'any' interfaces can also take array parameteris.all.undefined([{}, undefined]);=> false
Checks if the given value types are same.
is.sameType(42, 7);=> trueis.sameType(42, '7');=> falseis.not.sameType(42, 7);=> false
Checks if the given value is empty.
is.empty({});=> trueis.empty([]);=> trueis.empty('');=> trueis.not.empty(['foo']);=> trueis.all.empty('', {}, ['foo']);=> falseis.any.empty([], 42);=> true// 'all' and 'any' interfaces can also take array parameteris.all.empty([{}, 'foo']);=> false
Checks if the given value is existy. (not null or undefined)
is.existy({});=> trueis.existy(null);=> falseis.not.existy(undefined);=> trueis.all.existy(null, ['foo']);=> falseis.any.existy(undefined, 42);=> true// 'all' and 'any' interfaces can also take array parameteris.all.existy([{}, 'foo']);=> true
Checks if the given value is truthy. (existy and not false)
is.truthy(true);=> trueis.truthy(null);=> falseis.not.truthy(false);=> trueis.all.truthy(null, true);=> falseis.any.truthy(undefined, true);=> true// 'all' and 'any' interfaces can also take array parameteris.all.truthy([{}, true]);=> true
Checks if the given value is falsy.
is.falsy(false);=> trueis.falsy(null);=> trueis.not.falsy(true);=> trueis.all.falsy(null, false);=> trueis.any.falsy(undefined, true);=> true// 'all' and 'any' interfaces can also take array parameteris.all.falsy([false, true, undefined]);=> false
Checks if the given value is space.
is.space(' ');=> trueis.space('foo');=> falseis.not.space(true);=> trueis.all.space(' ', 'foo');=> falseis.any.space(' ', true);=> true// 'all' and 'any' interfaces can also take array parameteris.all.space([' ', 'foo', undefined]);=> false
Checks if the given value matches url regexp.
is.url('http://www.test.com');=> trueis.url('foo');=> falseis.not.url(true);=> trueis.all.url('http://www.test.com', 'foo');=> falseis.any.url('http://www.test.com', true);=> true// 'all' and 'any' interfaces can also take array parameteris.all.url(['http://www.test.com', 'foo', undefined]);=> false
Checks if the given value matches email regexp.
is.email('test@test.com');=> trueis.email('foo');=> falseis.not.email('foo');=> trueis.all.email('test@test.com', 'foo');=> falseis.any.email('test@test.com', 'foo');=> true// 'all' and 'any' interfaces can also take array parameteris.all.email(['test@test.com', 'foo', undefined]);=> false
Checks if the given value matches credit card regexp.
is.creditCard(378282246310005);=> trueis.creditCard(123);=> falseis.not.creditCard(123);=> trueis.all.creditCard(378282246310005, 123);=> falseis.any.creditCard(378282246310005, 123);=> true// 'all' and 'any' interfaces can also take array parameteris.all.creditCard([378282246310005, 123, undefined]);=> false
Checks if the given value matches alpha numeric regexp.
is.alphaNumeric('alphaNu3er1k');=> trueis.alphaNumeric('*?');=> falseis.not.alphaNumeric('*?');=> trueis.all.alphaNumeric('alphaNu3er1k', '*?');=> falseis.any.alphaNumeric('alphaNu3er1k', '*?');=> true// 'all' and 'any' interfaces can also take array parameteris.all.alphaNumeric(['alphaNu3er1k', '*?']);=> false
Checks if the given value matches time string regexp.
is.timeString('13:45:30');=> trueis.timeString('90:90:90');=> falseis.not.timeString('90:90:90');=> trueis.all.timeString('13:45:30', '90:90:90');=> falseis.any.timeString('13:45:30', '90:90:90');=> true// 'all' and 'any' interfaces can also take array parameteris.all.timeString(['13:45:30', '90:90:90']);=> false
Checks if the given value matches date string regexp.
is.dateString('11/11/2011');=> trueis.dateString('90/11/2011');=> falseis.not.dateString('90/11/2011');=> trueis.all.dateString('11/11/2011', '90/11/2011');=> falseis.any.dateString('11/11/2011', '90/11/2011');=> true// 'all' and 'any' interfaces can also take array parameteris.all.dateString(['11/11/2011', '90/11/2011']);=> false
Checks if the given value matches US zip code regexp.
is.usZipCode('02201-1020');=> trueis.usZipCode('123');=> falseis.not.usZipCode('123');=> trueis.all.usZipCode('02201-1020', '123');=> falseis.any.usZipCode('02201-1020', '123');=> true// 'all' and 'any' interfaces can also take array parameteris.all.usZipCode(['02201-1020', '123']);=> false
Checks if the given value matches Canada postal code regexp.
is.caPostalCode('L8V3Y1');=> trueis.caPostalCode('123');=> falseis.not.caPostalCode('123');=> trueis.all.caPostalCode('L8V3Y1', '123');=> falseis.any.caPostalCode('L8V3Y1', '123');=> true// 'all' and 'any' interfaces can also take array parameteris.all.caPostalCode(['L8V3Y1', '123']);=> false
Checks if the given value matches UK post code regexp.
is.ukPostCode('B184BJ');=> trueis.ukPostCode('123');=> falseis.not.ukPostCode('123');=> trueis.all.ukPostCode('B184BJ', '123');=> falseis.any.ukPostCode('B184BJ', '123');=> true// 'all' and 'any' interfaces can also take array parameteris.all.ukPostCode(['B184BJ', '123']);=> false
Checks if the given value matches North American numbering plan phone regexp.
is.nanpPhone('609-555-0175');=> trueis.nanpPhone('123');=> falseis.not.nanpPhone('123');=> trueis.all.nanpPhone('609-555-0175', '123');=> falseis.any.nanpPhone('609-555-0175', '123');=> true// 'all' and 'any' interfaces can also take array parameteris.all.nanpPhone(['609-555-0175', '123']);=> false
Checks if the given value matches extensible provisioning protocol phone regexp.
is.eppPhone('+90.2322456789');=> trueis.eppPhone('123');=> falseis.not.eppPhone('123');=> trueis.all.eppPhone('+90.2322456789', '123');=> falseis.any.eppPhone('+90.2322456789', '123');=> true// 'all' and 'any' interfaces can also take array parameteris.all.eppPhone(['+90.2322456789', '123']);=> false
Checks if the given value matches social security number regexp.
is.socialSecurityNumber('017-90-7890');=> trueis.socialSecurityNumber('123');=> falseis.not.socialSecurityNumber('123');=> trueis.all.socialSecurityNumber('017-90-7890', '123');=> falseis.any.socialSecurityNumber('017-90-7890', '123');=> true// 'all' and 'any' interfaces can also take array parameteris.all.socialSecurityNumber(['017-90-7890', '123']);=> false
Checks if the given value matches affirmative regexp.
is.affirmative('yes');=> trueis.affirmative('no');=> falseis.not.affirmative('no');=> trueis.all.affirmative('yes', 'no');=> falseis.any.affirmative('yes', 'no');=> true// 'all' and 'any' interfaces can also take array parameteris.all.affirmative(['yes', 'y', 'true', 't', 'ok', 'okay']);=> true
Checks if the given value matches hexadecimal regexp.
is.hexadecimal('f0f0f0');=> trueis.hexadecimal(2.5);=> falseis.not.hexadecimal('string');=> trueis.all.hexadecimal('ff', 'f50');=> trueis.any.hexadecimal('ff5500', true);=> true// 'all' and 'any' interfaces can also take array parameteris.all.hexadecimal(['fff', '333', 'f50']);=> true
Checks if the given value matches hexColor regexp.
is.hexColor('#333');=> trueis.hexColor('#3333');=> falseis.not.hexColor(0.5);=> trueis.all.hexColor('fff', 'f50');=> trueis.any.hexColor('ff5500', 0.5);=> false// 'all' and 'any' interfaces can also take array parameteris.all.hexColor(['fff', '333', 'f50']);=> true
Checks if the given value matches ip regexp.
is.ip('198.156.23.5');=> trueis.ip('1.2..5');=> falseis.not.ip('8:::::::7');=> trueis.all.ip('0:1::4:ff5:54:987:C', '123.123.123.123');=> trueis.any.ip('123.8.4.3', '0.0.0.0');=> true// 'all' and 'any' interfaces can also take array parameteris.all.ip(['123.123.23.12', 'A:B:C:D:E:F:0:0']);=> true
Checks if the given value matches ipv4 regexp.
is.ipv4('198.12.3.142');=> trueis.ipv4('1.2..5');=> falseis.not.ipv4('8:::::::7');=> trueis.all.ipv4('198.12.3.142', '123.123.123.123');=> trueis.any.ipv4('255.255.255.255', '850..1.4');=> true// 'all' and 'any' interfaces can also take array parameteris.all.ipv4(['198.12.3.142', '1.2.3']);=> false
Checks if the given value matches ipv6 regexp.
is.ipv6('2001:DB8:0:0:1::1');=> trueis.ipv6('985.12.3.4');=> trueis.not.ipv6('8:::::::7');=> trueis.all.ipv6('2001:DB8:0:0:1::1', '1:50:198:2::1:2:8');=> trueis.any.ipv6('255.255.255.255', '2001:DB8:0:0:1::1');=> true// 'all' and 'any' interfaces can also take array parameteris.all.ipv6(['2001:DB8:0:0:1::1', '1.2.3']);=> false
Checks if the given string contains a substring.
is.include('Some text goes here', 'text');=> trueis.include('test', 'text');=> falseis.not.include('test', 'text');=> true
Checks if the given string is UPPERCASE.
is.upperCase('YEAP');=> trueis.upperCase('nope');=> falseis.not.upperCase('Nope');=> trueis.all.upperCase('YEAP', 'nope');=> falseis.any.upperCase('YEAP', 'nope');=> true// 'all' and 'any' interfaces can also take array parameteris.all.upperCase(['YEAP', 'ALL UPPERCASE']);=> true
Checks if the given string is lowercase.
is.lowerCase('yeap');=> trueis.lowerCase('NOPE');=> falseis.not.lowerCase('Nope');=> trueis.all.lowerCase('yeap', 'NOPE');=> falseis.any.lowerCase('yeap', 'NOPE');=> true// 'all' and 'any' interfaces can also take array parameteris.all.lowerCase(['yeap', 'all lowercase']);=> true
Checks if the given string starts with substring.
is.startWith('yeap', 'ye');=> trueis.startWith('nope', 'ye');=> falseis.not.startWith('nope not that', 'not');=> true
Checks if the given string ends with substring.
is.endWith('yeap', 'ap');=> trueis.endWith('nope', 'no');=> falseis.not.endWith('nope not that', 'not');=> trueis.endWith('yeap that one', 'one');=> true
Checks if the given string is capitalized.
is.capitalized('Yeap');=> trueis.capitalized('nope');=> falseis.not.capitalized('nope not capitalized');=> trueis.capitalized('Yeap Capitalized');=> trueis.all.capitalized('Yeap', 'All', 'Capitalized');=> trueis.any.capitalized('Yeap', 'some', 'Capitalized');=> true// 'all' and 'any' interfaces can also take array parameteris.all.capitalized(['Nope', 'not']);=> false
Checks if the given string is palindrome.
is.palindrome('testset');=> trueis.palindrome('nope');=> falseis.not.palindrome('nope not palindrome');=> trueis.not.palindrome('tt');=> falseis.all.palindrome('testset', 'tt');=> trueis.any.palindrome('Yeap', 'some', 'testset');=> true// 'all' and 'any' interfaces can also take array parameteris.all.palindrome(['Nope', 'testset']);=> false
Checks if the given values are equal.
is.equal(42, 40 + 2);=> trueis.equal('yeap', 'yeap');=> trueis.equal(true, true);=> trueis.not.equal('yeap', 'nope');=> true
Checks if the given value is even.
is.even(42);=> trueis.not.even(41);=> trueis.all.even(40, 42, 44);=> trueis.any.even(39, 42, 43);=> true// 'all' and 'any' interfaces can also take array parameteris.all.even([40, 42, 43]);=> false
Checks if the given value is odd.
is.odd(41);=> trueis.not.odd(42);=> trueis.all.odd(39, 41, 43);=> trueis.any.odd(39, 42, 44);=> true// 'all' and 'any' interfaces can also take array parameteris.all.odd([40, 42, 43]);=> false
Checks if the given value is positive.
is.positive(41);=> trueis.not.positive(-42);=> trueis.all.positive(39, 41, 43);=> trueis.any.positive(-39, 42, -44);=> true// 'all' and 'any' interfaces can also take array parameteris.all.positive([40, 42, -43]);=> false
Checks if the given value is negative.
is.negative(-41);=> trueis.not.negative(42);=> trueis.all.negative(-39, -41, -43);=> trueis.any.negative(-39, 42, 44);=> true// 'all' and 'any' interfaces can also take array parameteris.all.negative([40, 42, -43]);=> false
Checks if the given value is above minimum value.
is.above(41, 30);=> trueis.not.above(42, 50);=> true
Checks if the given value is under maximum value.
is.under(30, 35);=> trueis.not.under(42, 30);=> true
Checks if the given value is within minimum and maximum values.
is.within(30, 20, 40);=> trueis.not.within(40, 30, 35);=> true
Checks if the given value is decimal.
is.decimal(41.5);=> trueis.not.decimal(42);=> trueis.all.decimal(39.5, 41.5, -43.5);=> trueis.any.decimal(-39, 42.5, 44);=> true// 'all' and 'any' interfaces can also take array parameteris.all.decimal([40, 42.5, -43]);=> false
Checks if the given value is integer.
is.integer(41);=> trueis.not.integer(42.5);=> trueis.all.integer(39, 41, -43);=> trueis.any.integer(-39, 42.5, 44);=> true// 'all' and 'any' interfaces can also take array parameteris.all.integer([40, 42.5, -43]);=> false
Checks if the given value is finite.
is.finite(41);=> trueis.not.finite(42 / 0);=> trueis.all.finite(39, 41, -43);=> trueis.any.finite(-39, Infinity, 44);=> true// 'all' and 'any' interfaces can also take array parameteris.all.finite([Infinity, -Infinity, 42.5]);=> false
Checks if the given value is infinite.
is.infinite(Infinity);=> trueis.not.infinite(42);=> trueis.all.infinite(Infinity, -Infinity, -43 / 0);=> trueis.any.infinite(-39, Infinity, 44);=> true// 'all' and 'any' interfaces can also take array parameteris.all.infinite([Infinity, -Infinity, 42.5]);=> false
Checks if the objects' property count is equal to given count.
is.propertyCount({this: 'is', 'sample': object}, 2);=> trueis.propertyCount({this: 'is', 'sample': object}, 3);=> falseis.not.propertyCount({}, 2);=> true
Checks if the given property is defined on object.
is.propertyDefined({yeap: 'yeap'}, 'yeap');=> trueis.propertyDefined({yeap: 'yeap'}, 'nope');=> falseis.not.propertyDefined({}, 'nope');=> true
Checks if the given object is window object.
is.windowObject(window);=> trueis.windowObject({nope: 'nope'});=> falseis.not.windowObject({});=> trueis.all.windowObject(window, {nope: 'nope'});=> falseis.any.windowObject(window, {nope: 'nope'});=> true// 'all' and 'any' interfaces can also take array parameteris.all.windowObject([window, {nope: 'nope'}]);=> false
Checks if the given object is a dom node.
var obj = document.createElement('div');is.domNode(obj);=> trueis.domNode({nope: 'nope'});=> falseis.not.domNode({});=> trueis.all.domNode(obj, obj);=> trueis.any.domNode(obj, {nope: 'nope'});=> true// 'all' and 'any' interfaces can also take array parameteris.all.domNode([obj, {nope: 'nope'}]);=> false
Checks if the given item is in array.
is.inArray(2, [1, 2, 3]);=> trueis.inArray(4, [1, 2, 3]);=> falseis.not.inArray(4, [1, 2, 3]);=> true
Checks if the given array is sorted.
is.sorted([1, 2, 3]);=> trueis.sorted([1, 2, 4, 3]);=> falseis.not.sorted([5, 4, 3]);=> trueis.all.sorted([1, 2], [3, 4]);=> trueis.any.sorted([1, 2], [5, 4]);=> true// 'all' and 'any' interfaces can also take array parameteris.all.sorted([[1, 2], [5, 4]]);=> false
Environment checks are not available as node module.
Checks if the current browser is ie. Parameter is optional version number of browser.
is.ie();=> true if current browser is ieis.ie(6);=> hopefully falseis.not.ie();=> false if current browser is ie
Checks if the current browser is edge.
is.edge();=> true if current browser is edgeis.not.edge();=> false if current browser is edge
Checks if the current browser is chrome.
is.chrome();=> true if current browser is chromeis.not.chrome();=> false if current browser is chrome
Checks if the current browser is firefox.
is.firefox();=> true if current browser is firefoxis.not.firefox();=> false if current browser is firefox
Checks if the current browser is opera.
is.opera();=> true if current browser is operais.not.opera();=> false if current browser is opera
Checks if the current browser is safari.
is.safari();=> true if current browser is safariis.not.safari();=> false if current browser is safari
Checks if the current device has ios.
is.ios();=> true if current device is iPhone, iPad or iPodis.not.ios();=> true if current device is not iPhone, iPad or iPod
Checks if the current device is iPhone.
is.iphone();=> true if current device is iPhoneis.not.iphone();=> true if current device is not iPhone
Checks if the current device is iPad.
is.ipad();=> true if current device is iPadis.not.ipad();=> true if current device is not iPad
Checks if the current device is iPod.
is.ipod();=> true if current device is iPodis.not.ipod();=> true if current device is not iPod
Checks if the current device has Android.
is.android();=> true if current device has Android OSis.not.android();=> true if current device has not Android OS
Checks if the current device is Android phone.
is.androidPhone();=> true if current device is Android phoneis.not.androidPhone();=> true if current device is not Android phone
Checks if the current device is Android tablet.
is.androidTablet();=> true if current device is Android tabletis.not.androidTablet();=> true if current device is not Android tablet
Checks if the current device is Blackberry.
is.blackberry();=> true if current device is Blackberryis.not.blackberry();=> true if current device is not Blackberry
Checks if the current device is Windows phone.
is.windowsPhone();=> true if current device is Windows phoneis.not.windowsPhone();=> true if current device is not Windows Phone
Checks if the current device is Windows tablet.
is.windowsTablet();=> true if current device is Windows tabletis.not.windowsTablet();=> true if current device is not Windows tablet
Checks if the current OS is Windows.
is.windows();=> true if current OS is Windowsis.not.windows();=> true if current OS is not Windows
Checks if the current OS is Mac OS X.
is.mac();=> true if current OS is Mac OS Xis.not.mac();=> true if current OS is not Mac OS X
Checks if the current OS is linux.
is.linux();=> true if current OS is linuxis.not.linux();=> true if current OS is not linux
Checks if the current device is desktop.
is.desktop();=> true if current device is desktopis.not.desktop();=> true if current device is not desktop
Checks if the current device is mobile.
iPhone, iPod, Android Phone, Windows Phone, Blackberry.
is.mobile();=> true if current device is mobileis.not.mobile();=> true if current device is not mobile
Checks if the current device is tablet.
iPad, Android Tablet, Windows Tablet
is.tablet();=> true if current device is tabletis.not.tablet();=> true if current device is not tablet
Checks if the current device is online.
is.online();=> true if current device is onlineis.not.online();=> true if current device is not online
Checks if the current device is offline.
is.offline();=> true if current device is offlineis.not.offline();=> true if current device is not offline
Checks if the current device supports touch.
is.touchDevice();=> true if current device supports touchis.not.touchDevice();=> true if current device doesn't support touch
Checks if the given date object indicate today.
var today = new Date();is.today(today);=> truevar yesterday = new Date(new Date().setDate(new Date().getDate() - 1));is.today(yesterday);=> falseis.not.today(yesterday);=> trueis.all.today(today, today);=> trueis.any.today(today, yesterday);=> true// 'all' and 'any' interfaces can also take array parameteris.all.today([today, yesterday]);=> false
Checks if the given date object indicate yesterday.
var today = new Date();is.yesterday(today);=> falsevar yesterday = new Date(new Date().setDate(new Date().getDate() - 1));is.yesterday(yesterday);=> trueis.not.yesterday(today);=> trueis.all.yesterday(yesterday, today);=> falseis.any.yesterday(today, yesterday);=> true// 'all' and 'any' interfaces can also take array parameteris.all.yesterday([today, yesterday]);=> false
Checks if the given date object indicate tomorrow.
var today = new Date();is.tomorrow(today);=> falsevar tomorrow = new Date(new Date().setDate(new Date().getDate() + 1));is.tomorrow(tomorrow);=> trueis.not.tomorrow(today);=> trueis.all.tomorrow(tomorrow, today);=> falseis.any.tomorrow(today, tomorrow);=> true// 'all' and 'any' interfaces can also take array parameteris.all.tomorrow([today, tomorrow]);=> false
Checks if the given date object indicate past.
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);=> trueis.past(tomorrow);=> falseis.not.past(tomorrow);=> trueis.all.past(tomorrow, yesterday);=> falseis.any.past(yesterday, tomorrow);=> true// 'all' and 'any' interfaces can also take array parameteris.all.past([yesterday, tomorrow]);=> false
Checks if the given date object indicate future.
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);=> falseis.future(tomorrow);=> trueis.not.future(yesterday);=> trueis.all.future(tomorrow, yesterday);=> falseis.any.future(yesterday, tomorrow);=> true// 'all' and 'any' interfaces can also take array parameteris.all.future([yesterday, tomorrow]);=> false
Checks if the given date objects' day equal given dayString parameter.
var mondayObj = new Date('01/26/2015');var tuesdayObj = new Date('01/27/2015');is.day(mondayObj, 'monday');=> trueis.day(mondayObj, 'tuesday');=> falseis.not.day(mondayObj, 'tuesday');=> true
Checks if the given date objects' month equal given monthString parameter.
var januaryObj = new Date('01/26/2015');var februaryObj = new Date('02/26/2015');is.month(januaryObj, 'january');=> trueis.month(februaryObj, 'january');=> falseis.not.month(februaryObj, 'january');=> true
Checks if the given date objects' year equal given yearNumber parameter.
var year2015 = new Date('01/26/2015');var year2016 = new Date('01/26/2016');is.year(year2015, 2015);=> trueis.year(year2016, 2015);=> falseis.not.year(year2016, 2015);=> true
Checks if the given year number is leapYear.
is.leapYear(2016);=> trueis.leapYear(2015);=> falseis.not.leapYear(2015);=> trueis.all.leapYear(2015, 2016);=> falseis.any.leapYear(2015, 2016);=> true// 'all' and 'any' interfaces can also take array parameteris.all.leapYear([2016, 2080]);=> true
Checks if the given date objects' day is weekend.
var monday = new Date('01/26/2015');var sunday = new Date('01/25/2015');var saturday = new Date('01/24/2015');is.weekend(sunday);=> trueis.weekend(monday);=> falseis.not.weekend(monday);=> trueis.all.weekend(sunday, saturday);=> trueis.any.weekend(sunday, saturday, monday);=> true// 'all' and 'any' interfaces can also take array parameteris.all.weekend([sunday, saturday, monday]);=> false
Checks if the given date objects' day is weekday.
var monday = new Date('01/26/2015');var sunday = new Date('01/25/2015');var saturday = new Date('01/24/2015');is.weekday(monday);=> trueis.weekday(sunday);=> falseis.not.weekday(sunday);=> trueis.all.weekday(monday, saturday);=> falseis.any.weekday(sunday, saturday, monday);=> true// 'all' and 'any' interfaces can also take array parameteris.all.weekday([sunday, saturday, monday]);=> false
Checks if the date is within given range.
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);=> trueis.inDateRange(saturday, sunday, monday);=> falseis.not.inDateRange(saturday, sunday, monday);=> true
Checks if the given date is between now and 7 days ago.
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);=> trueis.inLastWeek(nineDaysAgo);=> falseis.not.inLastWeek(nineDaysAgo);=> true
Checks if the given date is between now and a month ago.
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);=> trueis.inLastMonth(fortyDaysAgo);=> falseis.not.inLastMonth(fortyDaysAgo);=> true
Checks if the given date is between now and a year ago.
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);=> trueis.inLastYear(thirteenMonthsAgo);=> falseis.not.inLastYear(thirteenMonthsAgo);=> true
Checks if the given date is between now and 7 days later.
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);=> trueis.inNextWeek(nineDaysLater);=> falseis.not.inNextWeek(nineDaysLater);=> true
Checks if the given date is between now and a month later.
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);=> trueis.inNextMonth(fortyDaysLater);=> falseis.not.inNextMonth(fortyDaysLater);=> true
Checks if the given date is between now and a year later.
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);=> trueis.inNextYear(thirteenMonthsLater);=> falseis.not.inNextYear(thirteenMonthsLater);=> true
Checks if the given date is in the parameter quarter.
var firstQuarter = new Date('01/26/2015');var secondQuarter = new Date('05/26/2015');is.quarterOfYear(firstQuarter, 1);=> trueis.quarterOfYear(secondQuarter, 1);=> falseis.not.quarterOfYear(secondQuarter, 1);=> true
Checks if the given date is in daylight saving time.
// For Turkey Time Zonevar january1 = new Date('01/01/2015');var june1 = new Date('06/01/2015');is.dayLightSavingTime(june1);=> trueis.dayLightSavingTime(january1);=> falseis.not.dayLightSavingTime(january1);=> true
Override RegExps if you think they suck.
is.url('https://www.duckduckgo.com');=> trueis.setRegexp(/quack/, 'url');is.url('quack');=> true
Change namespace of library to prevent name collisions.
var customName = is.setNamespace();customName.odd(3);// => true