Have ideas to improve npm?Join in the discussion! »

    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;

    Install

    npm i error-if-not-primitive

    DownloadsWeekly Downloads

    8

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    2.94 kB

    Total Files

    4

    Last publish

    Collaborators

    • avatar