Registry / serialization / amp-is-object

amp-is-object

JSON →
library1.0.1jsnpmunverified

The `amp-is-object` package provides a minimalist utility function to reliably determine if a given JavaScript value is an object. It is part of the `ampersand.js` ecosystem, a loosely coupled, non-frameworky collection of modules for client-side applications, often drawing inspiration from Backbone.js. Crucially, this package is unrelated to Google's Accelerated Mobile Pages (AMP Project), which is a distinct initiative for web content optimization. Currently at version 1.0.1, `amp-is-object` is a stable, simple module with a focused scope. The broader `ampersand.js` project appears to be in a maintenance state with infrequent updates, meaning this utility package is largely static, offering consistent behavior without active feature development or frequent new releases. Its primary differentiation lies in its minimal footprint and specific role within the `ampersand.js` context, providing a core type-checking function.

npm install amp-is-object
INSTALL
IMPORT
SIG · AMP-IS-OBJECT
A
amp-is-object
serializationjavascriptv1.0.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

isObject
const isObject = require('amp-is-object');
import isObject from 'amp-is-object'; import { isObject } from 'amp-is-object';
This package is a CommonJS module. Use `require()` for compatibility, especially in Node.js environments. Direct ES module `import` syntax will not work without transpilation or specific Node.js loader configurations for CJS interoperability.

Demonstrates how to import and use the `isObject` function to check various JavaScript values.

const isObject = require('amp-is-object'); console.log('Is {} an object?', isObject({})); // Expected: true console.log('Is [] an object?', isObject([])); // Expected: true (arrays are objects in JS) console.log('Is null an object?', isObject(null)); // Expected: false (common JS gotcha) console.log('Is "hello" an object?', isObject('hello')); // Expected: false console.log('Is 123 an object?', isObject(123)); // Expected: false console.log('Is undefined an object?', isObject(undefined)); // Expected: false console.log('Is new Date() an object?', isObject(new Date())); // Expected: true
Debug
Known issues
gotchaThis package, `amp-is-object`, is part of the `ampersand.js` project and is NOT related to Google's Accelerated Mobile Pages (AMP Project / amp.dev). The names are coincidental, but the technologies and ecosystems are completely different. Do not confuse them.
fix
Verify the package origin (`ampersandjs` on GitHub) and context (a client-side JS framework utility) to ensure it aligns with your project's needs, distinct from Google AMP.
affects: >=1.0.0
gotchaThe `amp-is-object` package is implemented as a CommonJS module. In modern Node.js environments configured for ES Modules (`"type": "module"` in `package.json`), a direct `require()` call might lead to errors, or `import` statements might fail to resolve the module correctly without specific interoperability settings or transpilation.
fix
In ES Module contexts, consider using dynamic import (`import('amp-is-object').then(mod => mod)`) or ensure your build tools (e.g., Webpack, Rollup, Babel) are configured to handle CommonJS modules.
affects: >=1.0.0
gotchaThis package, being at version 1.0.1 and part of an older, largely maintenance-mode ecosystem (`ampersand.js`), is unlikely to receive new features, significant bug fixes, or updates to modern JavaScript paradigms (e.g., native ESM support, TypeScript definitions). It is stable but static.
fix
Consider if a more actively maintained and modern utility for object type checking (e.g., from Lodash, Underscore, or a dedicated modern small utility) would better suit long-term project needs, especially for new projects.
affects: >=1.0.0
Errors
Common errors & fixes
ReferenceError: require is not defined in ES module scope
Attempting to use `require()` in a JavaScript file that is being interpreted as an ES Module (e.g., due to `"type": "module"` in `package.json`).
fix
For basic CJS compatibility in ESM, you can typically use `import { createRequire } from 'module'; const require = createRequire(import.meta.url);` then `const isObject = require('amp-is-object');`. Alternatively, use a build tool that handles CJS-to-ESM conversion.
TypeError: (0, _ampIsObject.default) is not a function
This error occurs when an ES Module `import isObject from 'amp-is-object';` attempts to treat the CommonJS module's `module.exports` as a default export, but the export is not structured that way, or the transpiler/runtime incorrectly handles it.
fix
Since `amp-is-object` likely exports a single function directly via `module.exports = function() { ... }`, the correct (though sometimes still problematic in pure ESM) import if you absolutely must use `import` syntax would be `import isObject = require('amp-is-object');` (TypeScript specific) or `import * as isObject from 'amp-is-object';` followed by `isObject.default()` or `isObject()` depending on build/runtime behavior, but `require` is safest.
Upgrade
Version history
1.0.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
23 hits · last 30 days
node
20
OpenAI (training)
1
Resources
amp-is-object — npm install amp-is-object · libregistry