array-typeof

Checks the entries of an array for a specific type


Keywords
array, typeof, type, types, entry, entries, javascript, node, node-module, nodejs
License
GPL-3.0
Install
npm install array-typeof@0.1.0

Documentation

array-typeof

Checks the entries of an array for a specific type

Installing

Node.js environment

npm i array-typeof --save

Browser environment

Download the latest version of array-typeof here.

Usage

Node.js environment

const arrayTypeof = require("array-typeof");

console.log(arrayTypeof.isNumeric([1, 2.3, 4]));
//=> true

console.log(arrayTypeof.isNumeric([1, "2.3", 3]));
//=> false

console.log(arrayTypeof.isString(["Hello", "World"]));
//=> true

console.log(arrayTypeof.isString([true, "World"]));
//=> false

API

  • isNumeric(arr: Array<any>): boolean
    • Checks each entry of arr if it's a number or not.
  • isString(arr: Array<any>): boolean
    • Checks each entry of arr if it's a string or not.
  • isBoolean(arr: Array<any>): boolean
    • Checks each entry of arr if it's a boolean or not.
  • isObject(arr: Array<any>): boolean
    • Checks each entry of arr if it's an object or not.

Changelog

You can read the changelog here.

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the GPL-3.0 License - see here for more details.