error-if-not-populated-array

1.0.2 • Public • Published

errorIfNotPopulatedArray(arg): void

Function triggers error if arg is not an array with at least one item.

Examples

errorIfNotPopulatedArray([]);
// Error: "Input must be an array that is not empty"

errorIfNotPopulatedArray(8);
// Error: "Input must be array."

Installation

npm i error-if-not-populated-array

Loading

// if using TypeScript:
import { errorIfNotPopulatedArray } from 'error-if-not-populated-array';
// if using ES5 JavaScript:
var errorIfNotPopulatedArray = 
    require('error-if-not-populated-array').errorIfNotPopulatedArray;

Dependencies (2)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i error-if-not-populated-array

    Weekly Downloads

    4

    Version

    1.0.2

    License

    MIT

    Unpacked Size

    2.83 kB

    Total Files

    5

    Last publish

    Collaborators

    • writetome51