amp-is-object: Object Type Checker

1.0.1 · maintenance · verified Wed Apr 22

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.

Common errors

Warnings

Install

Imports

Quickstart

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

view raw JSON →