Socket
Book a DemoInstallSign in
Socket

estype

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

estype

EcmaScript Type Checker

latest
Source
npmnpm
Version
0.1.1
Version published
Maintainers
1
Created
Source

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

Keywords

type

FAQs

Package last updated on 07 Sep 2016

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