Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

typeof

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typeof

Node module. typeOf('a string') == 'string', typeOf([]) == 'array', etc.. Also supports named functions detections aka javascript classes

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
75K
increased by11.49%
Maintainers
1
Weekly downloads
 
Created
Source

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"

Keywords

FAQs

Package last updated on 21 Nov 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc