core-util-is

1.0.3 · abandoned · verified Sun Apr 19

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.

Common errors

Warnings

Install

Imports

Quickstart

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

view raw JSON →