New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

get-array-types

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

get-array-types

Get a beautiful representation of values in an Array.

latest
Source
npmnpm
Version
0.1.3
Version published
Maintainers
1
Created
Source

Array Types

Get a beautiful string representation of types inside of an Array.

Inspiration

To be completely fair, none. I needed a tiny, zero dependency package for a project that would do this, so I decided to create one.

Installation

Simply run

npm install --save get-array-types

Usage

const ArrayTypes = require('get-array-types')

console.log(ArrayTypes([1, 2, 3, 'Hello', 'World']).toString())
//=> Array<number|string>

console.log(ArrayTypes([1, 'Hello', 2, 'World']).elementTypes())
//=> ['number', 'string']

console.log(ArrayTypes([1, 2, 3]).isOfSingleType())
//=> true

console.log(ArrayTypes([1, 2, 'Oops.']).isOfSingleType())
//=> false

get-array-types also provides a useful utility function, isArray.

Use it as follows:

const isArray = require('get-array-types').isArray

console.log(isArray('Hello World.'))
//=> false

console.log(isArray([1, 2, 3]))
//=> true

License

  • MIT

Happy Javascripting! 〰️

Keywords

array

FAQs

Package last updated on 20 Aug 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts