Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
JavaScript

This branch is 39 commits behind master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
test
.gitignore
.jshintrc
Gruntfile.js
README.md
is.min.js
package.json

README.md

is-it

A simple validation module striving for code minimalism, a clear declarative syntax, and a thorough test suite.

Pairs with prove for validation sugar.

browser support

Installation

npm install is-it

Usage

var is = require('is-it')

var metal = "666"; // |..|.  .|..|

if (is.present(metal) && is.aNumber(metal)) {
  headBang();
}

For now, check the source and tests for a full run down of how things work.

Types of Validations

Operators

  • equal, eq
  • greaterThan, gt
  • greaterThanOrEqualTo, gte
  • lessThan, lt
  • lessThanOrEqualTo, lte

Primitives

  • array, arr
  • boolean, bool
  • func
  • nil
  • undef
  • present

Strings

  • string, str
  • emptyString, emtStr

Numbers

  • number, num
  • aNumber, aNum
  • integer, int
  • aInteger, aInt
  • zero
  • aZero

Dates

  • date
  • sameDate
  • today
  • futureDate, future
  • pastDate, past

Antonyms

is.not[methodName] will return the inverse all methods.

is.not.greaterThan(1, 2) // true : 1 is not greater than 2
Something went wrong with that request. Please try again.