Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

ensure-type

cheton453.4kMIT1.5.1

Ensure runtime type safety and perform type coercion if needed.

javascript, ensure, runtime, type, coercion

readme

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