The `amp-has` package provides a simple utility function, `has`, designed to check for the existence of nested properties within an object. It is part of the `ampersand.js` ecosystem, which was a collection of loosely coupled JavaScript modules for client-side applications. The package, currently at version 1.0.1, was last updated in April 2016 and is essentially a direct re-export of the `lodash.has` function. Given the minimal activity on the `ampersand.js` project and this specific utility's unmaintained status for many years, its release cadence is effectively ceased. Its key differentiator was its inclusion in the `ampersand.js` modular approach; however, modern applications are strongly advised to use `lodash.has` directly, which is actively maintained and supports contemporary JavaScript module systems.
npm install amp-hasVerified import paths — ran on the pinned version, not inferred.
Demonstrates importing and using the `has` function to safely check for the existence of nested properties within an object, including null or undefined paths.
Uninstall `amp-has` and install `lodash.has`. Replace `require('amp-has')` with `require('lodash.has')` or `import { has } from 'lodash';` if using a full Lodash build or ESM-compatible Lodash package.Ensure your project is configured for CommonJS, or use dynamic `import()` if you must use it in an ESM context, though switching to `lodash.has` (which supports ESM) is the better long-term solution. Example: `const has = await import('amp-has');` (note: this imports the module object, not the function directly).If staying with `amp-has`, use `const has = require('amp-has');`. Otherwise, migrate to `lodash.has` which offers better ESM support with modern tooling.The correct CommonJS import is `const has = require('amp-has');`.