Nascent Prototype Metaverse
Unleash awesomeness. Private packages, team management tools, and powerful integrations. Get started with npm Orgs »

estype

0.1.1 • Public • Published

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

install

npm i estype

Downloadsweekly downloads

1

version

0.1.1

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability