The `x-is-object` package provides a minimalist utility function designed to determine if a given JavaScript value is a 'proper object'. This specifically means it checks if the value inherits from `Object` while explicitly excluding `null`, which the standard `typeof value === 'object'` incorrectly classifies as an object. It correctly identifies plain objects, arrays, regular expressions, functions, dates, and wrapped primitives as objects. Currently at version 0.1.0, this package appears to be an older, largely unmaintained project. Its release cadence is effectively non-existent, and there's no indication of active development or planned updates. Key differentiators include its extreme simplicity and its clear, specific definition of what constitutes an object by explicitly excluding `null`, making it a focused alternative to more comprehensive type-checking libraries. It primarily targets CommonJS environments.
npm install x-is-objectVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to import and use the `isObject` function to test various values, highlighting its core behavior of returning true for true objects and false for primitives or null.
Consider using a more actively maintained and robust type-checking library, such as `lodash.isobject` or a custom utility for critical applications. If used, pin the exact version to avoid unexpected changes.
For CommonJS, use `require('x-is-object')`. For ESM, `import isObject from 'x-is-object';` might work but is not officially supported. Manual type declarations (`declare module 'x-is-object'`) would be needed for TypeScript projects.Be aware of `x-is-object`'s specific definition. If you need to check for plain objects only (e.g., `{}`), you'll need a different utility or a more specific check like `typeof value === 'object' && value !== null && value.constructor === Object`.For CommonJS, use `const isObject = require('x-is-object');`. For ESM, use `import isObject from 'x-is-object';`.Change the import statement to `import isObject from 'x-is-object';` to align with ES Module syntax. Ensure your build pipeline or Node.js environment correctly handles ES Modules.
No dependency data recorded yet.