Robust JavaScript Type Detection
JSON →type-of-is provides a reliable mechanism for JavaScript type detection and comparison, addressing the well-known quirks of the native `typeof` operator (e.g., `typeof null` being 'object', or arrays being 'object'). It uses a combination of `Object.prototype.toString` and constructor checks to determine the true type of a value, including primitives, built-in objects, and custom constructors. The package is currently at version 3.5.1, though the latest publicly listed version on npm (3.4.0) was published in February 2017, suggesting a very slow or effectively halted release cadence. Its key differentiator is its commitment to 'sensible / unsurprising' type results, making it suitable for validation and conditional logic where native `typeof` falls short. It offers functions like `Type.of` to get the constructor, `Type.string` for a string representation, and `Type.is` for comparison against a type or string.
Traffic · last 30 days ↓87% vs prev 7d
top countries 🇺🇸 United States · 🇨🇦 Canada · 🇩🇪 Germany · 🇫🇷 France