Ensure runtime type safety and perform type coercion if needed.
$ npm install --save ensure-type
import { ensureArray } from 'ensure-type';
ensureArray(null);
//=> []
ensureArray('apple');
//=> ['apple']
ensureArray(['apple', 'banana']);
//=> ['apple', 'banana']
ensureNumber
ensureNegativeNumber
ensurePositiveNumber
ensureFiniteNumber
ensureNegativeFiniteNumber
ensurePositiveFiniteNumber
ensureInteger
ensureNegativeInteger
ensurePositiveInteger
ensureNonNegativeInteger
ensureNonPositiveInteger
MIT