1.0.4 • Published 9 years ago

is-array-of v1.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
9 years ago

is-array-of Build Status

Installation

npm install is-array-of

Usage

Returns a function which check it's input against either a JavaScript type or a function.

var isArrayOf = require("is-array-of");
isArrayOf("string")(["a", "b", "c"]) // true
isArrayOf(n => n % 2)([1, 2, 3]) // false
isArrayOf(n => n % 2)([1, 3, 5]) // true

Why?

Useful for confirming all members of an array are what you expect, before you do something like map over them and hit an error at a harder to debug spot.