Registry / testing / core-util-is

core-util-is

JSON →
library1.0.3jsnpmunverified

core-util-is is a JavaScript utility package that provides polyfills for the `util.is*` functions (e.g., `isBuffer`, `isArray`, `isNumber`, `isString`, `isRegExp`) which were originally introduced in Node.js v0.12. The package is currently at version 1.0.3 and has not been updated in approximately 4-5 years, with its last known publish around 2021. These `util.is*` functions themselves were largely deprecated in Node.js v4.0.0 (released in 2015), with Node.js core encouraging developers to use native JavaScript alternatives (like `Array.isArray()`) or more robust userland modules. The package serves primarily to maintain backward compatibility for legacy Node.js environments or applications that specifically rely on these older `util` methods. It has no direct runtime dependencies, making it a lightweight inclusion for its specific purpose.

npm install core-util-is
INSTALL
IMPORT
SIG · CORE-UTIL-IS
C
core-util-is
testingjavascriptv1.0.3
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.

util
const util = require('core-util-is');
import util from 'core-util-is';
core-util-is is a CommonJS module and primarily consumed via `require()`. Direct default ESM imports might work in some modern Node.js setups that automatically wrap CJS modules, but named imports are not supported.
isBuffer, isArray
const { isBuffer, isArray } = require('core-util-is');
import { isBuffer, isArray } from 'core-util-is';
While CommonJS allows destructuring of the `require()` result, using named `import` syntax from a CJS module without specific `exports` configuration is incorrect and will fail in pure ESM environments.
util.isString
const util = require('core-util-is'); util.isString('hello');
import { isString } from 'core-util-is'; isString('hello');
The functions are properties of the default export object when using CommonJS. Attempting to access them via named ESM imports will result in errors.

This example demonstrates how to import `core-util-is` using CommonJS `require` and use a few of its `is*` utility functions.

const util = require('core-util-is'); console.log('Is \'hello\' a string?', util.isString('hello')); // Expected: true console.log('Is 123 a number?', util.isNumber(123)); // Expected: true console.log('Is [1,2,3] an array?', util.isArray([1, 2, 3])); // Expected: true // Demonstrating a native alternative for comparison console.log('Is [1,2,3] an array (native)?', Array.isArray([1, 2, 3])); // Expected: true
Debug
Known issues
deprecatedThe `util.is*` functions provided by this package are deprecated in modern Node.js versions (since Node.js v4.0.0). Developers are advised to use native JavaScript methods (e.g., `Array.isArray()`, `typeof`, `instanceof`) or more robust userland libraries.
fix
Migrate to native JavaScript type checking methods (e.g., `Array.isArray()`, `Number.isFinite()`, `typeof`) or actively maintained type utility libraries.
affects: >=1.0.0
gotchaThis package is a CommonJS module and does not natively support ES Module (ESM) `import` syntax. Attempting to use named imports will lead to errors in pure ESM environments.
fix
Always use `const util = require('core-util-is');` for importing this package. In an ESM context, you might be able to use `import util from 'core-util-is';` but it will only provide a default export, and named imports will not work.
affects: >=1.0.0
breakingThe package is no longer actively maintained. Its last update was around 4-5 years ago, and its GitHub repository shows minimal recent activity. This means there will be no new features, bug fixes, performance improvements, or security patches.
fix
Evaluate your project's reliance on `core-util-is`. For new projects or to update existing ones, consider replacing it with modern, actively maintained alternatives or native JavaScript constructs.
affects: >=1.0.3
gotchaDespite its inactivity, `core-util-is` has a very high number of weekly downloads (over 83 million), indicating widespread transitive dependency. This suggests that many projects might be pulling it in without direct intent, often through older dependencies that still rely on it.
fix
Regularly audit your project's dependency tree (`npm ls core-util-is`) to understand if and why this package is being included. If it's a transitive dependency, consider if the upstream package can be updated or replaced.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: Cannot destructure property 'isString' of require(...) as it is undefined.
Attempting to use ES Modules named import syntax or destructuring a non-object from a CommonJS module without a default export that provides named properties.
fix
Ensure you are using CommonJS `require` and correctly accessing properties from the imported object. For example, `const util = require('core-util-is'); util.isString('test');` or `const { isString } = require('core-util-is');` (if the module exports an object with these properties).
ReferenceError: require is not defined in ES module scope
Attempting to use CommonJS `require()` syntax within an ES Module file (`.mjs` or `.js` when `"type": "module"` is set in `package.json`).
fix
If your project is an ES Module, you will need to switch to `import util from 'core-util-is';`. Note that this will only provide a default export, and named imports will not function as expected for this CJS-only package. If possible, consider replacing the dependency with a modern alternative that supports ESM.
Error: Cannot find module 'core-util-is'
This error typically indicates that the package was not correctly installed, or there's an issue with npm's cache or Node.js environment setup.
fix
Try deleting `node_modules` and `package-lock.json` (or `yarn.lock`), then reinstalling dependencies with `npm install` or `yarn install`. In some cases, clearing the npm cache (`npm cache clean --force`) or reinstalling Node.js may be necessary.
Upgrade
Version history
1.0.3latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
7 hits · last 30 days
node
6
OpenAI (training)
1
Resources