Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including estype with all npm packages installed. Try it out:

var estype = require("estype")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

estype v0.1.1

EcmaScript Type Checker

estype

EcmaScript Type Checker.

Installation

Installing with npm:

$ npm install estype --save

This module does not have dependencies.

Usage

In a browser:

<script src="estype.js"></script>

In Node.js:

var type = require('estype');

Usage example:

var type = require('./estype');

var today = new Date();
if (type(today) === 'Date') {
    console.log('It\'s a date');
}

var obj = {};
if (type(obj) === 'Object') {
    console.log('It\'s an Object');
}

class MyClass extends Date {
}
var myObj = new MyClass();
if (type(myObj) === 'MyClass') {
    console.log('It\'s an instance of MyClass');
}

var result = Math.abs('text');
if (type(result) === 'NaN') {
    console.log('It\'s not a number');
}

Testing and complete reference of results

For testing and as a complete reference of available results, you can see https://github.com/todojs/estype/blob/master/test.js

Contributor

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free