Registry / testing / is-type

is-type

JSON →
library0.0.1jsnpmunverified

The `is-type` package provides a collection of utility functions for JavaScript type checking, mirroring functionalities often found in Node.js's `util.types` module, but exposed through a direct `is` object for easier access. Released at version `0.0.1` in 2013, this package is effectively unmaintained and has seen no updates since its initial publication. Its primary differentiation was offering a 'nicer API' compared to alternatives like `core-util-is`. Due to its age and lack of maintenance, it is not recommended for new projects. Current stable alternatives are either native JavaScript type checks, TypeScript, or modern utility libraries that provide similar functionality and better compatibility with contemporary JavaScript module systems and environments. It operates exclusively using CommonJS modules.

npm install is-type
INSTALL
IMPORT
SIG · IS-TYPE
I
is-type
testingjavascriptv0.0.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

is
const is = require('is-type');
import is from 'is-type';
This package was published in 2013 and is exclusively CommonJS; it does not support ES Modules. Attempting to import it using ES module syntax will fail.
is.array
const is = require('is-type'); is.array([]);
const { array } = require('is-type');
The package exposes a single `is` object with all type-checking methods. Destructuring directly from `require('is-type')` is not supported.

Demonstrates common type checks using the `is` object, including checks for arrays, strings, numbers, booleans, null, undefined, objects, functions, dates, regular expressions, primitives, and buffers (Node.js specific).

const is = require('is-type'); // Check basic types console.log('Is [1] an array?', is.array([1])); console.log('Is "hello" a string?', is.string('hello')); console.log('Is 123 a number?', is.number(123)); console.log('Is true a boolean?', is.boolean(true)); console.log('Is null null?', is.null(null)); console.log('Is undefined undefined?', is.undefined(undefined)); // Check for null or undefined console.log('Is null or undefined (null)?', is.nullOrUndefined(null)); console.log('Is null or undefined (undefined)?', is.nullOrUndefined(undefined)); console.log('Is null or undefined (0)?', is.nullOrUndefined(0)); // Check objects and functions console.log('Is {} an object?', is.object({})); console.log('Is function(){} a function?', is.function(() => {})); console.log('Is new Date() a date?', is.date(new Date())); console.log('Is new RegExp() a RegExp?', is.regExp(/a/)); // Check primitives console.log('Is true a primitive?', is.primitive(true)); console.log('Is {} a primitive?', is.primitive({})); // A buffer check (Node.js specific) try { console.log('Is Buffer.from("hi") a buffer?', is.buffer(Buffer.from('hi'))); } catch (e) { console.log('Buffer type check skipped (likely non-Node.js environment or Buffer not defined)'); }
Debug
Known issues
breakingThis package is an old CommonJS module (v0.0.1 from 2013) and does not support ES Modules. Using `import` statements will result in runtime errors.
fix
Use `const is = require('is-type');` for all imports. For modern projects requiring ESM, consider alternative type-checking libraries or native JavaScript checks.
affects: >=0.0.1
gotchaThe `is-type` package has been abandoned since its initial release in 2013. It is not maintained, may have unaddressed bugs or security vulnerabilities, and does not keep up with modern JavaScript features or environments.
fix
Avoid using this package for new projects. Migrate existing projects to actively maintained alternatives or native JavaScript type checks (e.g., `typeof`, `instanceof`, `Array.isArray()`, `Object.prototype.toString.call()`).
affects: >=0.0.1
gotchaSome type checks, particularly `is.buffer()`, rely on Node.js-specific global objects (`Buffer`). This package is primarily intended for Node.js environments and may not function correctly or might throw errors in browser environments without proper polyfills or build configurations.
fix
When using in a browser environment, be aware that Node.js-specific checks will fail. Consider conditional checks or ensure your build process adequately shims Node.js globals if necessary.
affects: >=0.0.1
Errors
Common errors & fixes
ReferenceError: require is not defined
Attempting to use `require()` in an ES Module context or a browser without a CommonJS loader.
fix
Ensure your environment is set up for CommonJS (e.g., a Node.js script without `"type": "module"` in package.json) or switch to a different type-checking library that supports ES Modules.
TypeError: is.array is not a function
The `is-type` package was not correctly imported or installed, or the `is` object is not accessible.
fix
Verify that `npm install is-type` was successful. Ensure you are importing the package correctly using `const is = require('is-type');` and that the `is` variable is in scope when calling its methods.
Upgrade
Version history
0.0.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
is-type — npm install is-type · libregistry