is-what-type is a lightweight and comprehensive JavaScript/TypeScript utility library designed for robust type checking of various values. It offers a single default export, `isWhatType`, which returns a string representation of a value's type, alongside numerous named exports like `isString`, `isNumber`, `isObject`, `isArray`, and `isPromise` for specific boolean checks. Currently at version 1.1.4, this library focuses on providing a wide array of type-checking functions, from primitive types to complex browser and Node.js-specific objects like Blob, File, and Buffer, making it suitable for both front-end and back-end development. Its main differentiator lies in its extensive collection of precise `isX` functions and the flexibility of getting a detailed type string, catering to detailed validation scenarios.
npm install is-what-typeVerified import paths — ran on the pinned version, not inferred.
Demonstrates importing both the default `isWhatType` function and several named `isX` type-checking functions, showing their usage with various data types and conditional checks.
Always use `import` statements for both default and named exports (`import isWhatType from 'is-what-type';` or `import { isString } from 'is-what-type';`) when working in an ESM-compatible environment. If CommonJS is required, ensure your bundler or environment correctly transpiles the imports.Always use `isWhatType(value) === 'typeString'` for reliable comparisons, or prefer the specific named `isX` functions (e.g., `isString(value)`) for boolean checks which are less prone to string comparison errors.
Understand the distinction: `isObject` will return true for any object, including class instances, while `isPlainObject` is stricter. Choose the appropriate function based on whether you need to check for any object or only plain JSON-like objects.
Change your import statement from `import { isWhatType } from 'is-what-type';` to `import isWhatType from 'is-what-type';`.Ensure you are using named imports correctly: `import { isString } from 'is-what-type';`. If using CommonJS, it should be `const { isString } = require('is-what-type');`.No dependency data recorded yet.