Socket
Socket
Sign inDemoInstall

array-comprehensions

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

array-comprehensions - npm Package Compare versions

Comparing version 0.5.1 to 0.5.2

2

package.json
{
"name": "array-comprehensions",
"version": "0.5.1",
"version": "0.5.2",
"description": "Array comprehensions",

@@ -5,0 +5,0 @@ "main": "forOf.js",

@@ -43,1 +43,39 @@ array-comprehensions

```
API
---
### forOf
#### `forOf(iterable, do)`
Execute the function `do` for each item of `iterable`.
```js
forOf([1, 2, 3], function(x){
return x+1;
}); // => [2, 3, 4]
```
#### `forOf(iterable, condition, do)`
Execute the function `do` for each item of `iterable` that fullfills the `condition`.
```js
forOf([1, 2, 3, 4], function(x) {
return x % 2 === 0;
}, function(x) {
return x*x;
}); // => [4,16]
```
#### `forOf(iterable1, iterable2, do)`
Execute the function `do` for each item of `iterable1` with every item of `iterable2`.
```js
forOf([1, 2], [1,2], function(x, y) {
return x*y;
}); // => [1,2,2,4]
```
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