1.0.0 • Published 3 years ago

@melgrove/type v1.0.0

Weekly downloads
8
License
MIT
Repository
github
Last release
3 years ago

type

A tiny type checker with vectorization. Outputs types as lowercase strings.

api

type(value, vectorized = false)

value

Value to get type of

vectorized

A boolean which determines whether to map the type checker over an input array. value must be an array if vectorized = true.

const type = require('@melgrove/type');

type(5);
// 'number'

type(['typeof', 'sux']);
// 'array'

type([null, '2', {c: 3}, () => 4, undefined], true);
// [ 'null', 'string', 'object', 'function', 'undefined' ]