isit.js
This is a general-purpose check library.
- No dependencies
- AMD, Node & browser ready
- Supports all ES5 and above environments (IE8 and below with es5-shim)
Note
The origin of this project was the wonderful work done by arasatasaygin at is.js, and should be a drop-in replacement for it (outside renaming of is to isit). I noticed there has hasn't been work on it in months, and the issues are growing, so I originally just did a fork of the work. From there I rearchitected the library to be a modular setup that is ES2015-driven and has complete test coverage. I have also made minor tweaks and bugfixes based on the backlog in is.js, but mainly I hope to grow it from here.
Install:
Node.js:
npm i isitjs --save
Usage:
// ES2015
import isit from "isitjs";
// CommonJS
var isit = require("isitjs");
// if you just want specific categories
import isitType from "isit/lib/type";
// or
var isitType from require("isit/lib/type").default;
// if you just want specific modules
import {
isitBoolean // all functions are named the same, just with "isit" in front and made camelCase
} from "isitjs/lib/type";
// or
var isitBoolean = require("isitjs/lib/type").isitBoolean;
Custom build:
TBD ... this feature was janky from the beginning and may no longer be needed with the modular setup. To do it right will take some time, so I'll wait to hear from the community before I invest the time to build it.
Type checks
isit.arguments(value:any)
Checks if the given value type is arguments.
interfaces: not, all, any
var { return arguments;};var arguments = ; isitargumentsarguments; true isitnotargumentsfoo: 'bar'; true isitallargumentsarguments 'bar'; false isitanyarguments'foo' arguments; true // 'all' and 'any' interfaces can also take array parameterisitallargumentsarguments 'foo' 'bar'; false
isit.array(value:any)
Checks if the given value type is array.
interfaces: not, all, any
isit; true isitnot; true isitall; false isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
isit.boolean(value:any)
Checks if the given value type is boolean.
interfaces: not, all, any
isit; true isitnot; true isitall; false isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
isit.date(value:any)
Checks if the given value type is date.
interfaces: not, all, any
isit; true isitnot; true isitall; false isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
isit.error(value:any)
Checks if the given value type is error.
interfaces: not, all, any
isit; true isitnot; true isitall; false isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
isit.function(value:any)
Checks if the given value type is function.
interfaces: not, all, any
isit; true isitnot; true isitall; false isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
isit.nan(value:any)
Checks if the given value type is NaN.
interfaces: not, all, any
isit; true isitnot; true isitall; false isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
isit.null(value:any)
Checks if the given value type is null.
interfaces: not, all, any
isit; true isitnot; true isitall; false isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
isit.number(value:any)
Checks if the given value type is number.
interfaces: not, all, any
isit; true isit; false isitnot; true isitall; false isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
isit.object(value:any)
Checks if the given value type is object.
interfaces: not, all, any
isitobjectfoo: 'bar'; true // functions are also returning as trueisitobjecttoString; true isitnotobject'foo'; true isitallobject{} 1; false isitanyobject{} 2; true // 'all' and 'any' interfaces can also take array parameterisitallobject{} ; true
isit.json(value:any)
Checks if the given value type is pure json object.
interfaces: not, all, any
isit; true // functions are returning as falseisit; false isitnot; true isitall; false isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; true
isit.regexp(value:any)
Checks if the given value type is RegExp.
interfaces: not, all, any
isit; true isitnot; true isitall; false isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
isit.string(value:any)
Checks if the given value type is string.
interfaces: not, all, any
isit; true isitnot; true isitall; false isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
isit.char(value:any)
Checks if the given value type is char.
interfaces: not, all, any
isit; true isitnot; true isitall; false isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; true
isit.undefined(value:any)
Checks if the given value type is undefined.
interfaces: not, all, any
isitundefinedundefined; true isitnotundefinednull; true isitallundefinedundefined 1; false isitanyundefinedundefined 2; true // 'all' and 'any' interfaces can also take array parameterisitallundefined{} undefined; false
isit.sameType(value:any, value:any)
Checks if the given value types are same type.
interface: not
isit; true isit; false isitnot; false
isit.typedArray(value:any)
Checks if the given value is a typed array.
interfaces: not, all, any
isit; true isit; false isitnot; false isitall; false isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
Presence checks
isit.empty(value:object|array|string)
Checks if the given value is empty.
interfaces: not, all, any
isit; true isit; true isit; true isitnot; true isitall; false isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
isit.existy(value:any)
Checks if the given value is existy. (not null or undefined)
interfaces: not, all, any
isit; true isit; false isitnot; true isitall; false isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; true
isit.truthy(value:any)
Checks if the given value is truthy. (existy and not false)
interfaces: not, all, any
isit; true isit; false isitnot; true isitall; false isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; true
isit.falsy(value:any)
Checks if the given value is falsy.
interfaces: not, all, any
isit; true isit; true isitnot; true isitall; true isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
isit.space(value:string)
Checks if the given value is space.
interfaces: not, all, any
isit; true isit; false isitnot; true isitall; false isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
isit.whitespace(value:string)
Checks if the given value is whitespace.
interfaces: not, all, any
isit; true isit; false isitnot; true isitall; true isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
RegExp checks
isit.url(value:any)
Checks if the given value matches url regexp.
interfaces: not, all, any
isit; true isit; false isitnot; true isitall; false isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
isit.email(value:any)
Checks if the given value matches email regexp.
interfaces: not, all, any
isit; true isit; false isitnot; true isitall; false isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
isit.creditCard(value:any)
Checks if the given value matches credit card regexp.
interfaces: not, all, any
isit; true isit; false isitnot; true isitall; false isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
isit.alphaNumeric(value:any)
Checks if the given value matches alpha numeric regexp.
interfaces: not, all, any
isit; true isit; false isitnot; true isitall; false isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
isit.timeString(value:any)
Checks if the given value matches time string regexp.
interfaces: not, all, any
isit; true isit; false isitnot; true isitall; false isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
isit.dateString(value:any)
Checks if the given value matches date string regexp.
interfaces: not, all, any
isit; true isit; false isitnot; true isitall; false isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
isit.usZipCode(value:any)
Checks if the given value matches US zip code regexp.
interfaces: not, all, any
isit; true isit; false isitnot; true isitall; false isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
isit.caPostalCode(value:any)
Checks if the given value matches Canada postal code regexp.
interfaces: not, all, any
isit; true isit; true isit; false isitnot; true isitall; false isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
isit.ukPostCode(value:any)
Checks if the given value matches UK post code regexp.
interfaces: not, all, any
isit; true isit; false isitnot; true isitall; false isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
isit.nanpPhone(value:any)
Checks if the given value matches North American numbering plan phone regexp.
interfaces: not, all, any
isit; true isit; false isitnot; true isitall; false isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
isit.eppPhone(value:any)
Checks if the given value matches extensible provisioning protocol phone regexp.
interfaces: not, all, any
isit; true isit; false isitnot; true isitall; false isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
isit.socialSecurityNumber(value:any)
Checks if the given value matches social security number regexp.
interfaces: not, all, any
isit; true isit; false isitnot; true isitall; false isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
isit.affirmative(value:any)
Checks if the given value matches affirmative regexp.
interfaces: not, all, any
isit; true isit; false isitnot; true isitall; false isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; true
isit.hexadecimal(value:any)
Checks if the given value matches hexadecimal regexp.
interfaces: not, all, any
isit; true isit; false isitnot; true isitall; true isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; true
isit.hexColor(value:any)
Checks if the given value matches hexcolor regexp.
interfaces: not, all, any
isit; true isit; false isitnot; true isitall; true isitany; false // 'all' and 'any' interfaces can also take array parameterisitall; true
isit.ip(value:string)
Checks if the given value matches ip regexp
interfaces: not, all, any
isit; true isit; false isitnot; true isitall; true isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; true
isit.ipv4(value:string)
Checks if the given value matches ipv4 regexp
interfaces: not, all, any
isit; true isit; false isitnot; true isitall; true isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
isit.ipv6(value:string)
Checks if the given value matches ipv6 regexp
interfaces: not, all, any
isit; true isit; true isitnot; true isitall; true isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
isit.isoDateString(value:any)
Checks if the given value matches valid ISO strings (full ISO compliance).
interfaces: not, all, any
isit; true isit; false isitnot; true isitall; false isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; true
String checks
isit.include(value:string, value:substring)
Checks if the given string contains a substring.
interfaces: not
isit; true isit; false isitnot; true
isit.includes(value:string, value:substring)
alias for isit.include
isit.upperCase(value:string)
Checks if the given string is UPPERCASE.
interfaces: not, all, any
isit; true isit; false isitnot; true isitall; false isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; true
isit.lowerCase(value:string)
Checks if the given string is lowercase.
interfaces: not, all, any
isit; true isit; false isitnot; true isitall; false isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; true
isit.startWith(value:string, value:substring)
Checks if the given string starts with substring.
interface: not
isit; true isit; false isitnot; true
isit.startsWith(value:string, value:substring)
alias for isit.startWith
isit.endWith(value:string, value:substring)
Checks if the given string ends with substring.
interfaces: not
isit; true isit; false isitnot; true isit; true
isit.endsWith(value:string, value:substring)
alias for isit.endWith
isit.capitalized(value:string)
Checks if the given string is capitalized.
interfaces: not, all, any
isit; true isit; false isitnot; true isitall; true isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
isit.palindrome(value:string, value:substring)
Checks if the given string is palindrome.
interfaces: not, all, any
isit; true isit; false isitnot; true isitall; true isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
isit.camelCase(value:string)
Checks if the given string is camelCase.
interfaces: not, all, any
isit; true isit; false isitnot; true isitall; true isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
isit.kebabCase(value:string)
Checks if the given string is -kebab-case.
interfaces: not, all, any
isit; true isit; false isitnot; true isitall; true isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
isit.snakeCase(value:string)
Checks if the given string is snake_case.
interfaces: not, all, any
isit; true isit; false isitnot; true isitall; true isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
isit.startCase(value:string)
Checks if the given string is Start Case.
interfaces: not, all, any
isit; true isit; false isitnot; true isitall; true isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
isit.doubleByte(value:string)
Checks if the given string contains two-byte (or non-Latin) characters.
interfaces: not, all, any
isit; true isit; false isitnot; true isitall; true isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
isit.html(value:string)
Checks if the given string contains HTML tags.
interfaces: not, all, any
isit; true isit; false isitnot; true isitall; true isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
isit.dataUrl(value:string)
Checks if the given string is a data URL.
interfaces: not, all, any
isit; true isit; false isitnot; true isitall; true isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
Arithmetic checks
isit.equal(value:any, value:any)
Checks if the given values are equal. For objects and arrays, deep equality checks occur.
interfaces: not
isit; true isit; true isit; true isit; true isit; true isitnot; true isitnot; // for arrays, order matters for equality true
isit.even(value:number)
Checks if the given value is even.
interfaces: not, all, any
isit; true isitnot; true isitall; true isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
isit.odd(value:number)
Checks if the given value is odd.
interfaces: not, all, any
isit; true isitnot; true isitall; true isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
isit.positive(value:number)
Checks if the given value is positive.
interfaces: not, all, any
isit; true isitnot; true isitall; true isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
isit.negative(value:number)
Checks if the given value is negative.
interfaces: not, all, any
isit; true isitnot; true isitall; true isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
isit.above(value:number, min)
Checks if the given value is above minimum value.
interface: not
isitabove41 30; true isitnotabove42 50; true
isit.over(value:number, min)
alias for isit.above
isit.under(value:number, min)
Checks if the given value is under maximum value.
interface: not
isit; true isitnot; true
isit.below(value:number, min)
alias for isit.under
isit.within(value:number, min, max)
Checks if the given value is within minimum and maximum values.
interface: not
isit; true isitnot; true
isit.decimal(value:number)
Checks if the given value is decimal.
interfaces: not, all, any
isit; true isitnot; true isitall; true isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
isit.integer(value:number)
Checks if the given value is integer.
interfaces: not, all, any
isit; true isitnot; true isitall; true isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
isit.finite(value:number)
Checks if the given value is finite.
interfaces: not, all, any
isit; true isitnot; true isitall; true isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
isit.infinite(value:number)
Checks if the given value is infinite.
interfaces: not, all, any
isit; true isitnot; true isitall; true isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
Object checks
isit.propertyCount(value:object, count)
Checks if objects' property count is equal to given count.
interface: not
isit; true isit; false isitnot; true
isit.propertyDefined(value:object, property)
Checks if the given property is defined on object.
interface: not
isit; true isit; false isitnot; true
isit.windowObject(value:window)
Checks if the given object is window object.
interfaces: not, all, any
isit; true isit; false isitnot; true isitall; false isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
isit.domNode(value:object)
Checks if the given object is a dom node.
interfaces: not, all, any
var obj = document;isit; true isit; false isitnot; true isitall; true isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
isit.jquery(value:object)
Checks if the given object is a jQuery object or jQuery itself.
interfaces: not, all, any
isit; true isit; false isitnot; true isitall; true isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
isit.domNodeList(value:object)
Checks if the given object is a dom NodeList.
interfaces: not, all, any
var obj = document;isit; true isit; false isitnot; true isitall; true isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
isit.plainObject(value:object)
Checks if the given object is a plain JavaScript object.
interfaces: not, all, any
isit; true isit; false isitnot; true isitall; false isitall; true // 'all' and 'any' interfaces can also take array parameterisitall; false
Array checks
isit.inArray(value:any, array)
Checks if the given item is in array?
interface: not
isit; true isit; false isitnot; true
isit.sorted(value:array)
Checks if the given array is sorted.
interfaces: not, all, any
isit; true isit; false isitnot; true isitall; // sort checks either ascending or descending true isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
Environment checks
Environment checks are not available as node module.
isit.browser()
Checks if current environment is browser.
interface: not
isit true if in browser
isit.node()
Checks if current environment is nodejs.
interface: not
isit true if in nodejs
isit.ie(value:number)
Checks if current browser is ie. Parameter is optional version number of browser.
interface: not
isit; true if current browser is ie isit; hopefully false isitnot; false if current browser is ie
isit.chrome()
Checks if current browser is chrome.
interface: not
isit; true if current browser is chrome isitnot; false if current browser is chrome
isit.firefox()
Checks if current browser is firefox.
interface: not
isit; true if current browser is firefox isitnot; false if current browser is firefox
isit.opera()
Checks if current browser is opera.
interface: not
isit; true if current browser is opera isitnot; false if current browser is opera
isit.safari()
Checks if current browser is safari.
interface: not
isit; true if current browser is safari isitnot; false if current browser is safari
isit.ios()
Checks if current device has ios.
interface: not
isit; true if current device is iPhone iPad or iPod isitnot; true if current device is not iPhone iPad or iPod
isit.iphone()
Checks if current device is iPhone.
interface: not
isit; true if current device is iPhone isitnot; true if current device is not iPhone
isit.ipad()
Checks if current device is iPad.
interface: not
isit; true if current device is iPad isitnot; true if current device is not iPad
isit.ipod()
Checks if current device is iPod.
interface: not
isit; true if current device is iPod isitnot; true if current device is not iPod
isit.android()
Checks if current device has Android.
interface: not
isit; true if current device has Android OS isitnot; true if current device has not Android OS
isit.androidPhone()
Checks if current device is Android phone.
interface: not
isit; true if current device is Android phone isitnot; true if current device is not Android phone
isit.androidTablet()
Checks if current device is Android tablet.
interface: not
isit; true if current device is Android tablet isitnot; true if current device is not Android tablet
isit.blackberry()
Checks if current device is Blackberry.
interface: not
isit; true if current device is Blackberry isitnot; true if current device is not Blackberry
isit.windowsPhone()
Checks if current device is Windows phone.
interface: not
isit; true if current device is Windows phone isitnot; true if current device is not Windows Phone
isit.windowsTablet()
Checks if current device is Windows tablet.
interface: not
isit; true if current device is Windows tablet isitnot; true if current device is not Windows tablet
isit.windows()
Checks if current OS is Windows.
interface: not
isit; true if current OS is Windows isitnot; true if current OS is not Windows
isit.mac()
Checks if current OS is Mac OS X.
interface: not
isit; true if current OS is Mac OS X isitnot; true if current OS is not Mac OS X
isit.linux()
Checks if current OS is linux.
interface: not
isit; true if current OS is linux isitnot; true if current OS is not linux
isit.desktop()
Checks if current device is desktop.
interface: not
isit; true if current device is desktop isitnot; true if current device is not desktop
isit.mobile()
Checks if current device is mobile.
interface: not iPhone, iPod, Android Phone, Windows Phone, Blackberry.
isit; true if current device is mobile isitnot; true if current device is not mobile
isit.tablet()
Checks if current device is tablet.
interface: not iPad, Android Tablet, Windows Tablet
isit; true if current device is tablet isitnot; true if current device is not tablet
isit.online()
Checks if current device is online.
interface: not
isit; true if current device is online isitnot; true if current device is not online
isit.offline()
Checks if current device is offline.
interface: not
isit; true if current device is offline isitnot; true if current device is not offline
isit.touchDevice()
Checks if current device supports touch.
interface: not
isit; true if current device supports touch isitnot; true if current device does not support touch
isit.blink()
Checks if browser rendering engine is Blink.
interface: not
isit; true if browser render with Blink isitnot; true if browser does not render with Blink
isit.gecko()
Checks if browser rendering engine is Gecko.
interface: not
isit; true if browser render with Gecko isitnot; true if browser does not render with Gecko
isit.presto()
Checks if browser rendering engine is Presto.
interface: not
isit; true if browser render with Presto isitnot; true if browser does not render with Presto
isit.trident()
Checks if browser rendering engine is Trident.
interface: not
isit; true if browser render with Trident isitnot; true if browser does not render with Trident
isit.webkit()
Checks if browser rendering engine is WebKit.
interface: not
isit; true if browser render with WebKit isitnot; true if browser does not render with WebKit
Time checks
isit.today(value:object)
Checks if the given date object indicate today.
interfaces: not, all, any
var today = ;isit; true var yesterday = ;isit; false isitnot; true isitall; true isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
isit.yesterday(value:object)
Checks if the given date object indicate yesterday.
interfaces: not, all, any
var today = ;isit; false var yesterday = ;isit; true isitnot; true isitall; false isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
isit.tomorrow(value:object)
Checks if the given date object indicate tomorrow.
interfaces: not, all, any
var today = ;isit; false var tomorrow = ;isit; true isitnot; true isitall; false isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
isit.past(value:object)
Checks if the given date object indicate past.
interfaces: not, all, any
var yesterday = ;var tomorrow = ; isit; true isit; false isitnot; true isitall; false isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
isit.future(value:object)
Checks if the given date object indicate future.
interfaces: not, all, any
var yesterday = ;var tomorrow = ; isit; false isit; true isitnot; true isitall; false isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
isit.day(value:object, dayString)
Checks if the given date objects' day equal given dayString parameter. If not given, dayString defaults to current day.
interface: not
var mondayObj = '01/26/2015';var tuesdayObj = '01/27/2015';isit; true isit; false isitnot; true
isit.month(value:object, monthString)
Checks if the given date objects' month equal given monthString parameter. If not given, monthString defaults to current month.
interface: not
var januaryObj = '01/26/2015';var februaryObj = '02/26/2015';isit; true isit; false isitnot; true
isit.year(value:object, yearNumber)
Checks if the given date objects' year equal given yearNumber parameter. If not given, yearNumber defaults to current year.
interface: not
var year2015 = '01/26/2015';var year2016 = '01/26/2016';isit; true isit; false isitnot; true
isit.leapYear(value:number)
Checks if the given year number is a leap year
interfaces: not, all, any
isit; true isit; false isitnot; true isitall; false isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; true
isit.weekend(value:object)
Checks if the given date objects' day is weekend.
interfaces: not, all, any
var monday = '01/26/2015';var sunday = '01/25/2015';var saturday = '01/24/2015';isit; true isit; false isitnot; true isitall; true isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
isit.weekday(value:object)
Checks if the given date objects' day is weekday.
interfaces: not, all, any
var monday = '01/26/2015';var sunday = '01/25/2015';var saturday = '01/24/2015';isit; true isit; false isitnot; true isitall; false isitany; true // 'all' and 'any' interfaces can also take array parameterisitall; false
isit.inDateRange(value:object, startObject, endObject)
Checks if date is within given range.
interface: not
var saturday = '01/24/2015';var sunday = '01/25/2015';var monday = '01/26/2015';isit; true isit; false isitnot; true
isit.inLastWeek(value:object)
Checks if the given date is between now and 7 days ago.
interface: not
var twoDaysAgo = ;var nineDaysAgo = ;isit; true isit; false isitnot; true
isit.inLastMonth(value:object)
Checks if the given date is between now and a month ago.
interface: not
var tenDaysAgo = ;var fortyDaysAgo = ;isit; true isit; false isitnot; true
isit.inLastYear(value:object)
Checks if the given date is between now and a year ago.
interface: not
var twoMonthsAgo = ;var thirteenMonthsAgo = ;isit; true isit; false isitnot; true
isit.inNextWeek(value:object)
Checks if the given date is between now and 7 days later.
interface: not
var twoDaysLater = ;var nineDaysLater = ;isit; true isit; false isitnot; true
isit.inNextMonth(value:object)
Checks if the given date is between now and a month later.
interface: not
var tenDaysLater = ;var fortyDaysLater = ;isit; true isit; false isitnot; true
isit.inNextYear(value:object)
Checks if the given date is between now and a year later.
interface: not
var twoMonthsLater = ;var thirteenMonthsLater = ;isit; true isit; false isitnot; true
isit.quarterOfYear(value:object, quarterNumber)
Checks if the given date is in the parameter quarter.
interface: not
var firstQuarter = '01/26/2015';var secondQuarter = '05/26/2015';isit; true isit; false isitnot; true
isit.daylightSavingTime(value:object, quarterNumber)
Checks if the given date is in daylight saving time.
interface: not
// For Turkey Time Zonevar january1 = '01/01/2015';var june1 = '06/01/2015'; isit; true isit; false isitnot; true
isit.daylightSavingsTime(value:object, quarterNumber)
alias for isit.daylightSavingTime
Configuration methods
isit.setRegexp(value:RegExp, regexpString)
Override RegExps if you think they suck.
isit; true isit;isit; true