Lodash isUndefined Function

3.0.1 · maintenance · verified Sun Apr 19

This package, `lodash.isundefined` (version 3.0.1), provides the `_.isUndefined` utility function from the Lodash library as a standalone Node.js CommonJS module. It is designed to check if a value is strictly `undefined`, returning `true` for `undefined` and `false` for all other values, including `null`. While the main Lodash library is actively maintained and currently at version 4.18.x with frequent releases, this specific modular package has not been updated since its 3.0.1 release, aligning with Lodash v3.x. Its key differentiator was providing a lightweight option compared to importing the entire Lodash library, but modern bundlers often make `lodash-es` (or direct `lodash` imports with tree-shaking) a more efficient alternative for specific functions.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates how to import `isUndefined` using CommonJS and check various values for being strictly undefined.

const isUndefined = require('lodash.isundefined');

const value1 = undefined;
const value2 = null;
const value3 = 'hello';
const value4 = {};

console.log(`Is value1 (${value1}) undefined? ${isUndefined(value1)}`); // true
console.log(`Is value2 (${value2}) undefined? ${isUndefined(value2)}`); // false
console.log(`Is value3 ('${value3}') undefined? ${isUndefined(value3)}`); // false
console.log(`Is value4 (${JSON.stringify(value4)}) undefined? ${isUndefined(value4)}`); // false

// Demonstrating the equivalent with modern Lodash v4+
// This would typically involve installing 'lodash' or 'lodash-es'
// const { isUndefined: modernIsUndefined } = require('lodash');
// console.log(`Modern check: Is value1 undefined? ${modernIsUndefined(value1)}`);

view raw JSON →