Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

foreach

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

foreach

foreach component + npm package

  • 2.0.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.4M
decreased by-14.44%
Maintainers
1
Weekly downloads
 
Created

What is foreach?

The 'foreach' npm package provides a utility for iterating over arrays and objects in a concise and consistent manner. It allows developers to execute a function for each element in an array or each property in an object, similar to the native forEach method available on arrays in JavaScript.

What are foreach's main functionalities?

Iterating over arrays

This feature allows you to iterate over each item in an array and execute a function that has access to the item value, index, and the original array.

foreach([1, 2, 3], function(value, index, array) {
  console.log(value);
});

Iterating over object properties

This feature allows you to iterate over each key-value pair in an object and execute a function that has access to the value, key, and the original object.

foreach({ a: 1, b: 2, c: 3 }, function(value, key, object) {
  console.log(key + ': ' + value);
});

Other packages similar to foreach

Keywords

FAQs

Package last updated on 11 May 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc