get-object-type

0.0.2 • Public • Published

get-object-type

NPM version Build Status Code Climate Coverage Status Dependency Status devDependency Status

NPM

Description

get the type of a javascript object as a string. an alternative to using typeof checks.

NOTE: I've re-written / used this function so many different times, I decided to publish it as a module.

Getting Started

Install the module with: npm install get-object-type

var getType = require('get-object-type');
getType(null); // returns 'Null'
getType([]); // returns 'Array'
getType({foo: 'bar'}); // returns 'Object'
getType(42); // returns 'Number'

License

Copyright (c) 2014 skratchdot
Licensed under the MIT license.

Package Sidebar

Install

npm i get-object-type

Weekly Downloads

4

Version

0.0.2

License

MIT

Last publish

Collaborators

  • skratchdot