The `isobj` package provides a highly focused utility function designed to determine if a given JavaScript value is an 'object literal', specifically designed to exclude arrays (`[]`) and `null`. Released as version `1.0.0` in April 2014, the package has seen no subsequent updates or maintenance, indicating it is an abandoned project. Its functionality, based on its usage examples and common patterns for such utilities, likely checks if the `typeof` operator returns 'object' while also ensuring the value is not `null` and not an array (`Array.isArray`). Notably, it *does* return `true` for instances like `new Date()` or `new RegExp()`, which are JavaScript objects but not strictly 'plain' object literals (i.e., created by `{}`). Due to its age and lack of modern JavaScript module support (it's CommonJS-only), developers are generally advised to implement this check directly using native JavaScript constructs or opt for more actively maintained utility libraries that offer broader compatibility and features.
npm install isobjVerified import paths — ran on the pinned version, not inferred.
Demonstrates `isobj` usage with various data types, highlighting its interpretation of 'object literal' which includes `Date` and `RegExp` objects, but excludes `null` and arrays.
Prefer native JavaScript checks (`typeof value === 'object' && value !== null && !Array.isArray(value)`) or consider using actively maintained alternatives like `is-plain-object` if strictly plain objects are required, or a modern utility library like Lodash (`_.isObjectLike`) or Ramda for broader object checking needs.
Always use `const isObj = require('isobj');` to import this package. If you are in an ESM-only project, consider wrapping it in a CJS loader or replacing it with a modern ESM-compatible utility.For strictly plain objects, use `is-plain-object` or implement a custom check like `typeof value === 'object' && value !== null && value.constructor === Object && Object.prototype.toString.call(value) === '[object Object]'`.
Manually declare types in a `.d.ts` file (e.g., `declare module 'isobj' { function isObj(value: unknown): boolean; export = isObj; }`) or migrate to a modern utility with built-in TypeScript support.Change the import statement to `const isObj = require('isobj');`.Ensure your environment supports CommonJS `require()`. In browser contexts, use a bundler. In modern Node.js ESM files (`.mjs` or `type: 'module'` in `package.json`), you cannot directly use `require()`. Consider rewriting the check with native JavaScript or using an ESM-compatible utility.
If you need to check for strictly 'plain' objects (e.g., `{}`), use a dedicated utility like `is-plain-object` or implement a more specific native JavaScript check.No dependency data recorded yet.