Skip to content
This repository was archived by the owner on Jun 6, 2026. It is now read-only.

Repository files navigation

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.

Type Utils

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).

Installation

Using NPM or Yarn

npm install '@beautiful-code/type-utils'
yard add '@beautiful-code/type-utils'

Usage

Basic Usage

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

Releases

Packages

Used by

Contributors

Languages