Skip to content

Ensure runtime type safety and perform type coercion if needed.

License

Notifications You must be signed in to change notification settings

cheton/ensure-type

Repository files navigation

ensure-type Build Status Coverage Status

NPM

Ensure runtime type safety and perform type coercion if needed.

Install

$ npm install --save ensure-type

Usage

import { ensureArray } from 'ensure-type';

ensureArray(null);
//=> []

ensureArray('apple');
//=> ['apple']

ensureArray(['apple', 'banana']);
//=> ['apple', 'banana']

API

Array

BigInt

Boolean

Function

Number

Object

String

License

MIT

About

Ensure runtime type safety and perform type coercion if needed.

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published