error-if-not-primitive

1.0.0 • Public • Published

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;

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i error-if-not-primitive

      Weekly Downloads

      3

      Version

      1.0.0

      License

      MIT

      Unpacked Size

      2.94 kB

      Total Files

      4

      Last publish

      Collaborators

      • writetome51