{"id":10676,"library":"core-util-is","title":"core-util-is","description":"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.","status":"abandoned","version":"1.0.3","language":"javascript","source_language":"en","source_url":"git://github.com/isaacs/core-util-is","tags":["javascript","util","isBuffer","isArray","isNumber","isString","isRegExp","isThis","isThat"],"install":[{"cmd":"npm install core-util-is","lang":"bash","label":"npm"},{"cmd":"yarn add core-util-is","lang":"bash","label":"yarn"},{"cmd":"pnpm add core-util-is","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"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.","wrong":"import util from 'core-util-is';","symbol":"util","correct":"const util = require('core-util-is');"},{"note":"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.","wrong":"import { isBuffer, isArray } from 'core-util-is';","symbol":"isBuffer, isArray","correct":"const { isBuffer, isArray } = require('core-util-is');"},{"note":"The functions are properties of the default export object when using CommonJS. Attempting to access them via named ESM imports will result in errors.","wrong":"import { isString } from 'core-util-is'; isString('hello');","symbol":"util.isString","correct":"const util = require('core-util-is');\nutil.isString('hello');"}],"quickstart":{"code":"const util = require('core-util-is');\n\nconsole.log('Is \\'hello\\' a string?', util.isString('hello')); // Expected: true\nconsole.log('Is 123 a number?', util.isNumber(123));     // Expected: true\nconsole.log('Is [1,2,3] an array?', util.isArray([1, 2, 3])); // Expected: true\n\n// Demonstrating a native alternative for comparison\nconsole.log('Is [1,2,3] an array (native)?', Array.isArray([1, 2, 3])); // Expected: true","lang":"javascript","description":"This example demonstrates how to import `core-util-is` using CommonJS `require` and use a few of its `is*` utility functions."},"warnings":[{"fix":"Migrate to native JavaScript type checking methods (e.g., `Array.isArray()`, `Number.isFinite()`, `typeof`) or actively maintained type utility libraries.","message":"The `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.","severity":"deprecated","affected_versions":">=1.0.0"},{"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.","message":"This 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.","severity":"gotcha","affected_versions":">=1.0.0"},{"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.","message":"The 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.","severity":"breaking","affected_versions":">=1.0.3"},{"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.","message":"Despite 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.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"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).","cause":"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.","error":"TypeError: Cannot destructure property 'isString' of require(...) as it is undefined."},{"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.","cause":"Attempting to use CommonJS `require()` syntax within an ES Module file (`.mjs` or `.js` when `\"type\": \"module\"` is set in `package.json`).","error":"ReferenceError: require is not defined in ES module scope"},{"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.","cause":"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.","error":"Error: Cannot find module 'core-util-is'"}],"ecosystem":"npm"}