New: Introducing PHP and Composer Support.Read the Announcement
Socket
Book a DemoInstallSign in
Socket

is-a

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-a

type checking "micro library"

Source
npmnpm
Version
0.1.1
Version published
Weekly downloads
11
57.14%
Maintainers
1
Weekly downloads
 
Created
Source

is-a

type checking "micro library"

Build Status

Installation

$ npm install is-a

Usage

var is = require('is-a');

//get type safely
console.log(is([]).toString()); //Array
(function() { console.log(is(arguments).toString()); })();  //Arguments
console.log(is(false).toString()); //Boolean
console.log(is(new Date).toString()); //Date
console.log(is(function(){}).toString()); //Function
console.log(is(Math).toString()); //Math
console.log(is(null).toString()); //Null
console.log(is(0).toString()); //Number
console.log(is({}).toString()); //Object
console.log(is(/./).toString()); //RegExp
console.log(is("").toString()); //String
console.log(is().toString()); //Undefined


//test types legibly
console.log(is([]).a.Number()); //false
console.log(is([]).an.Array()); //true
console.log(is(/./).a.Primitive()); //false
console.log(is(/./).a.CoreObject()); //true
console.log(is(/./).a.JsonBasicType()); //false
console.log(is(/./).a.BuiltinType()); //true

Keywords

typeof

FAQs

Package last updated on 29 Nov 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts