Skip to content

hugojing/typee

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

typee

A Javascript library for type checking.

Installation

Use Yarn or npm:

$ yarn add typee
$ npm i typee --save

Module Loading

It's an UMD module, so you can:

// ECMAScript 2015+ (via Babel)
import typee from 'typee'
// CommonJS
const typee = require('typee')
<!-- browser globals -->
<script src="YOUR_PATH_TO/node-modules/typee/dist/typee-umd-compiled.min.js"></script>

Usage

typee(null) // "Null"

typee(1) // "Number"

typee([1, 2, 3]) // "Array"

typee({k: 'v'}) // "Object"

typee(new Date()) // "Date"

typee(new Map()) // "Map"

typee(new Error()) // "Error"

typee(new Event('evt')) // "Event"

typee(async function() {}) // "AsyncFunction"

typee(new Promise(resolve => resolve(1))) // "Promise"

About

A Javascript library for type checking

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published