1.1.3 • Published 5 years ago

typesafe-is v1.1.3

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

typesafe-is

version license build Coverage Status

Example

import { isString } from 'typesafe-is';

let x: string | number;

if (isString(x)) {
  console.log(x.subtr(1)); // Error, 'subtr' does not exist on `string`
  console.log(x.substr(1)); // OK
} else {
  console.log(x.substr(1)); // Error
  console.log(x.subtr(1)); // OK, 'subtr' exists on number
}

Installation

This module is distributed via npm which is bundled with node and should be installed as one of your project's dependencies:

npm install --save typesafe-is

or

yarn add typesafe-is

API

All functions can be imported with one of the following statements:

import { isNil } from 'typesafe-is'; // this works
const { isNil } = require('typesafe-is'); // this works too

See here for full list of available typechecking functions.

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago