# @pakal/for-each

> ForEach is package from Pakal library

Latest version **0.2.1** (published 2019-04-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install @pakal/for-each
pnpm add @pakal/for-each
yarn add @pakal/for-each
bun add @pakal/for-each
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.1 |
| Published | 2019-04-15 |
| First published | 2018-07-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 47.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Yisrael Eliev |
| Maintainers | yisraelx |
| Keywords | utils, utilities, modules, modular |

## Links

- npm: https://www.npmjs.com/package/@pakal/for-each
- Repository: https://github.com/yisraelx/pakal
- Homepage: https://github.com/yisraelx/pakal#readme
- Issues: https://github.com/yisraelx/pakal/issues
- npm.io page: https://npm.io/package/@pakal/for-each

## Dependencies (3)

- [@pakal/keys](https://npm.io/package/@pakal/keys.md) ^0.2.1
- [@pakal/type-of](https://npm.io/package/@pakal/type-of.md) ^0.2.1
- [@pakal/is-type-of](https://npm.io/package/@pakal/is-type-of.md) ^0.2.1

## Recent versions

- 0.2.1 (latest) — 2019-04-15
- 0.2.0 — 2019-03-31
- 0.1.1 — 2018-07-14
- 0.1.0 — 2018-07-03

## README

# @pakal/for-each
[![Source Code](https://img.shields.io/badge/%3C%2F%3E-source_code-blue.svg)](https://github.com/yisraelx/pakal/blob/master/modules/for-each)
[![Version](https://img.shields.io/npm/v/@pakal/for-each.svg)](https://www.npmjs.com/package/@pakal/for-each)
[![MIT License](https://img.shields.io/npm/l/@pakal/for-each.svg?color=yellow)](https://github.com/yisraelx/pakal/blob/master/LICENSE)
[![Bundle Size](https://img.shields.io/bundlephobia/min/@pakal/for-each.svg?color=green)](https://bundlephobia.com/result?p=@pakal/for-each)
[![TypeScript](https://img.shields.io/badge/100%25-TypeScript-blue.svg)](https://www.typescriptlang.org)

**ForEach is package from Pakal library**

## Install
```sh
$ yarn add @pakal/for-each
```
Or
```sh
$ npm install --save @pakal/for-each
```

## Use
**Module**
```typescript
import {
  default as forEach
} from '@pakal/for-each';
```

**Browser**
```html
<script src="https://unpkg.com/@pakal/for-each/bundle.umd.min.js"></script>
```
```typescript
let {
  forEach
} = _;
```

**Examples**
```typescript
 let word: string = 'abc';

 forEach(word, (char: string, index: number, array: string) => {
     console.log(`${index} = ${value}`);
 });

 // => '0 = a'
 // => '1 = b'
 // => '2 = c'
 // => 'abc'
```
```typescript
 let array: boolean[] = [true, true, false, true, true];

 forEach(array, (value: boolean, index: number) => {
     console.log(index);
     return value;
 });

 // => 0
 // => 1
 // => 2
 // => array
```
```typescript
 let array: ArrayLike<any> = {length: 2, 1: 'some', foo: 'bar'};

 forEach(array, console.log);

 // => undefined 0 array
 // => 33 'some' array
 // => array
```
```typescript
 let object: {[key: string: number]} = {a: 1, b: 2,c: 3};

 forEach(object, (value: number, key: string, object: {[key: string: number]}) => {
     console.log(`${key} = ${value}`);
 });

 // => 'a = 1'
 // => 'b = 2'
 // => 'c = 3'
 // => object
```
```typescript
 forEach(); // => undefined
 forEach(null); // => null
 forEach(true, console.log); // => true
```
```typescript
 let _log = (value: any) => (console.log(value), value);
 let collection = {
  get foo(){ return _log('bar'); },
  get non(){ return _log(false); },
  get name(){ return _log('bob'); }
 };

 forEach(collection);

 // => 'foo'
 // => false
 // => collection
```


## License
Copyright © [Yisrael Eliev](https://github.com/yisraelx),
Licensed under the [MIT license](https://github.com/yisraelx/pakal/blob/master/LICENSE).

---
_Source: https://npm.io/package/@pakal/for-each · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
