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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.5.1
    63,849
    • latest

Version History

Package Sidebar

Install

npm i ensure-type

Weekly Downloads

63,897

Version

1.5.1

License

MIT

Unpacked Size

18.3 kB

Total Files

5

Last publish

Collaborators

  • cheton