Type checking code bricks for JavaScript.
type.isfunction( function ( ) { } ) ;
Can be managed through jspm,
duo,
component,
bower,
ender,
jam,
spm,
and npm.
Install
jspm
jspm install github:aureooms/js-type
# or
jspm install npm:aureooms-js-type
duo
No install step needed for duo!
component
component install aureooms/js-type
bower
bower install aureooms-js-type
ender
ender add aureooms-js-type
jam
jam install aureooms-js-type
spm
spm install aureooms-js-type --save
npm
npm install aureooms-js-type --save
Require
jspm
let type = require( "github:aureooms/js-type" ) ;
import type from 'aureooms-js-type' ;
duo
let type = require( "aureooms/js-type" ) ;
component, ender, spm, npm
let type = require( "aureooms-js-type" ) ;
bower
The script tag exposes the global variable type
.
<script src="bower_components/aureooms-js-type/js/dist/type.min.js"></script>
Alternatively, you can use any tool mentioned here.
jam
require( [ "aureooms-js-type" ] , function ( type ) { ... } ) ;
Use
Generic methods
type.isinstance( object )
type.isnull( object )
type.isundefined( object )
Methods for numbers
type.isfinite( object )
type.isint32( object )
type.isint( object )
type.isnan( object )
type.isnegativeinfinity( object )
type.isnumber( object )
type.ispositiveinfinity( object )
Methods for objects
type.isarray( object )
type.isboolean( object )
type.isdate( object )
type.isfunction( object )
type.isobject( object )
type.isregexp( object )
type.isstring( object )