node module extending typeof functionality
CoffeeScript JavaScript
Switch branches/tags
Nothing to show
Latest commit 290b095 Nov 21, 2013 @CodingFu version bump to 1.0.0
Permalink
Failed to load latest commit information.
.gitignore
MIT-LICENSE
README.md
index.js
package.json
test.coffee

README.md

typeof

Small node.js module that dramatically extends functionality of native typeof

Inspired by Batman.js typeOf util

UPD: now it returns lowercased name of any javascript class. Thanks to @BallBearing for idea

Usage:

$ npm install typeof
var typeOf = require('typeof');

console.log(typeOf("a string"));
// -> "string"

console.log(typeOf([1, 2, 3, "array"]));
// -> "array"

console.log(typeOf(null));
// -> "null"

console.log(typeOf(new Buffer(0)));
// -> "buffer"

function MyClass() {
  this.is = "class constructor"  
}
console.log(typeOf(new MyClass));
// ->"myclass"