Skip to content

Gets the most specific common type of all the values in an array

License

Notifications You must be signed in to change notification settings

DABH/array-typeof-values

Repository files navigation

array-typeof-values

Build Status version dependencies devDependencies

Gets the most specific common type of all the values in an array

TypeScript definitions included!

Installation

npm install array-typeof-values

Usage

var arrayTypeOfValues = require('array-typeof-values');

arrayTypeOfValues(['a', 'b', 'c']); // -> 'string'
arrayTypeOfValues(['a', 2, 'c']); // -> 'object'
arrayTypeOfValues([[1], ['b'], []]); // -> 'array'
arrayTypeOfValues([]); // -> undefined

License

MIT © https://github.com/DABH

About

Gets the most specific common type of all the values in an array

Resources

License

Stars

Watchers

Forks

Packages

No packages published