amp-each is a lightweight JavaScript utility module, part of the ampersand.js project, designed to provide an iteration function similar to `Array.prototype.forEach` or `_.each` from Lodash. It allows iterating over both arrays and objects, applying a callback function to each element or property. The ampersand.js ecosystem, from which amp-each originates, was popular around 2015-2017 as a modular alternative to larger frameworks like Backbone.js, favoring CommonJS modules for client-side applications. However, the project appears to be largely unmaintained, with its core modules having last seen significant updates many years ago (e.g., ampersand-state last published 8 years ago from October 2017). This package, at version 1.0.1, should be considered abandoned, lacking recent updates, active development, or a clear release cadence. Its primary differentiator was being part of a "non-frameworky" collection of modules, offering granular control over application structure.
npm install amp-eachVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to use `amp-each` to iterate over arrays and objects, applying a callback function to each element or property, and passing a context object.
Consider replacing with native JavaScript methods (e.g., `Array.prototype.forEach`, `Object.keys().forEach`) or a actively maintained utility library like Lodash (`_.each`).
Ensure you use `const each = require('amp-each');` for Node.js environments or configure your bundler (e.g., Webpack, Rollup) to handle CJS modules if targeting browsers.Prefer native JavaScript iteration methods for better maintainability, performance, and reduced bundle size.
If you must use this library, install `@types/amp-each` if available (unlikely due to abandonment) or create a custom declaration file (e.g., `amp-each.d.ts`) to provide type information.
Change the file to a CommonJS module (e.g., rename to `.cjs`, remove `"type": "module"` from `package.json`, or configure your build system). Alternatively, use a dynamic import (`import('amp-each').then(mod => mod)`), though this package is not designed for it.If transpilation is in place, try `import * as each from 'amp-each';` and then use `each.default(collection, fn)`. However, the recommended fix is to revert to `const each = require('amp-each');`.Ensure the import is `const each = require('amp-each');` for CommonJS, or verify your bundler's configuration if using ES modules in a browser context.No dependency data recorded yet.