ensure-type

1.5.1 • Public • Published

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

Package Sidebar

Install

npm i ensure-type

Weekly Downloads

79,469

Version

1.5.1

License

MIT

Unpacked Size

18.3 kB

Total Files

5

Last publish

Collaborators

  • cheton