1.0.0 • Published 5 years ago
error-if-not-primitive v1.0.0
errorIfNotPrimitive(arg): void
Triggers error if arg
is not a primitive type.
The only types considered primitive here are number, string, and boolean.
Example
errorIfNotPrimitive([]);
// Error: "Input must be either a number, string, or boolean"
Installation
npm i error-if-not-primitive
Loading
// if using TypeScript:
import { errorIfNotPrimitive } from 'error-if-not-primitive';
// if using ES5 JavaScript:
var errorIfNotPrimitive = require('error-if-not-primitive').errorIfNotPrimitive;
1.0.0
5 years ago