i-s
A module to check whether a JavaScript value is of a certain type
Last updated 12 years ago by radubrehar .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install i-s 
SYNC missed versions from official npm registry.

i-s

Checks whether a JavaScript valis is of a certain type

Install

$ npm install i-s

Usage

var is = require('i-s')

API

numeric

is.numeric('567') === true
is.numeric('a') === false
is.numeric(4) === true

number

is.number('567') === false
is.number('a') === false
is.number(4) === true
is.number(4.3) === true

int

is.int('567') === false
is.int('a') === false
is.int(4) === true
is.int(4.3) === false

float

is.number('567') === false
is.number('a') === false
is.number(4) === false
is.number(4.3) === true

string

is.string('abc') === true

function

function f(){}
is.function(f) === true

object

is.object({}) === true

arguments

is.arguments(function(){return arguments}()) === true
is.arguments([]) === false

boolean

is.boolean(true) === true
is.boolean(false) === true
is.boolean({}) === false

date

is.date(new Date()) === true

regexp

is.regexp(/a/) === true
is.regexp(new RegExp('/a/')) === true

array

is.array([]) === true
is.array(function(){ return arguments }()) === false

Browser

For usage in browser, include dist/index.js

Tests

$ make

Watch mode:

$ make test-w

License

MIT

Current Tags

  • 1.2.3                                ...           latest (12 years ago)

13 Versions

  • 1.2.3                                ...           12 years ago
  • 1.2.2                                ...           12 years ago
  • 1.2.1                                ...           12 years ago
  • 1.2.0                                ...           12 years ago
  • 1.1.3                                ...           12 years ago
  • 1.1.2                                ...           12 years ago
  • 1.1.1                                ...           12 years ago
  • 1.1.0                                ...           12 years ago
  • 1.0.4                                ...           12 years ago
  • 1.0.3                                ...           12 years ago
  • 1.0.2                                ...           12 years ago
  • 1.0.1                                ...           12 years ago
  • 1.0.0                                ...           12 years ago
Maintainers (1)
Downloads
Total 39
Today 0
This Week 0
This Month 12
Last Day 0
Last Week 0
Last Month 3
Dependencies (0)
None
Dev Dependencies (4)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE