Important
This package has moved. It now lives in beautiful-code-monorepo as packages/type-utils. This repository is archived; the modern 1.0 rewrite ships from the monorepo.
This is a simple, type identification and validation library. This handles both native types, and es6 types, as well as jQuery objects. This is intended to be used imported via Node.js (or a bundler like Webpack for client side).
npm install '@beautiful-code/type-utils'
yard add '@beautiful-code/type-utils'
const TypeUtils = require('@beautiful-code/type-utils').TypeUtils
let o = {},
a = [1, 2, 3],
s = 'string',
m = new Map()
TypeUtils.getType(o) // object
TypeUtils.getType(a) // array
TypeUtils.getType(s) // string
TypeUtils.getType(m) // map