# fzip

> Zip collections and map or iterate over the result at once

Latest version **0.2.0** (published 2014-10-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install fzip
pnpm add fzip
yarn add fzip
bun add fzip
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2014-10-18 |
| First published | 2014-10-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Eugene Sharygin |
| Maintainers | eush77 |
| Keywords | functional, zip, map, each, forEach, collection, array, object, keys, spec |

## Links

- npm: https://www.npmjs.com/package/fzip
- Repository: https://github.com/eush77/fzip
- Issues: https://github.com/eush77/fzip/issues
- npm.io page: https://npm.io/package/fzip

## Dependencies (2)

- [lodash.zip](https://npm.io/package/lodash.zip.md) ^2.4.1
- [lodash.zipobject](https://npm.io/package/lodash.zipobject.md) ^2.4.1

## Alternatives

- [lodash.startswith](https://npm.io/package/lodash.startswith.md) — 769.7K weekly downloads
- [@tarojs/service](https://npm.io/package/@tarojs/service.md) — 33.9K weekly downloads
- [io.extendreality.tilia.indicators.spatialtargets.unity](https://npm.io/package/io.extendreality.tilia.indicators.spatialtargets.unity.md) — 131 weekly downloads
- [@rtarojs/taro](https://npm.io/package/@rtarojs/taro.md) — 90 weekly downloads
- [node-branch-io](https://npm.io/package/node-branch-io.md) — 50 weekly downloads

## Recent versions

- 0.2.0 (latest) — 2014-10-18
- 0.1.0 — 2014-10-12

## README

# fzip [![Build Status][travis-badge]][travis] [![Dependency Status][david-badge]][david] [![DevDependency Status][david-dev-badge]][david-dev]

[![npm](https://nodei.co/npm/fzip.png)](https://nodei.co/npm/fzip/)

[travis-badge]: https://travis-ci.org/eush77/fzip.svg
[travis]: https://travis-ci.org/eush77/fzip
[david-badge]: https://david-dm.org/eush77/fzip.png
[david]: https://david-dm.org/eush77/fzip
[david-dev-badge]: https://david-dm.org/eush77/fzip/dev-status.png
[david-dev]: https://david-dm.org/eush77/fzip#info=devDependencies

Zip collections and map or iterate over the result at once. Combination of `zip` and `map`, or `zip` and `forEach`.

Accepts functions and string specs (to build objects from). Falls back to plain `zip`.

## Examples

```js
> fzip([0, 1, 2], [2, 1, 0], function (a, b) {
    return a + b;
  })
[2, 2, 2]

> fzip([0, 1, 2], function (x) {
    return 2 - x;
  })
[2, 1, 0]

> fzip(['mom', 'dad', 'dog'], ['dear', 'awesome', 'joyful'], 'name, adjective')
[ { name: 'mom', adjective: 'dear' },
  { name: 'dad', adjective: 'awesome' },
  { name: 'dog', adjective: 'joyful' } ]

> fzip([0, 1, 2], [2, 1, 0])
[[0, 2], [1, 1], [2, 0]]

> fzip([0, 1, 2])
[[0], [1], [2]]


> sums = []
> fzip.each([0, 1, 2], [2, 1, 0], function (a, b) {
    sums.push(a + b);
  })
> sums
[2, 2, 2]

> sum = 0
> fzip.each([0, 1, 2], function (a) {
    sum += a;
  })
> sum
3
```

## API

### fzip([array]..., func)

Apply `func` to arrays, passing one argument per array each time. Collect returned values in the resulting array.

Return `null` if no arrays given.

### fzip([array]..., spec)

Construct array of objects according to a string `spec`, which must comprise object keys, separated by comma and optional whitespace. The number of keys and the number of arrays should match.

Return `null` if no arrays given.

### fzip([array]...)

Zip arrays into a single array of corresponding items (see examples).

Return `null` if no arrays given.

### fzip.each([array]..., func)

Similar to `fzip([array]..., func)`, but does not collect the results.

## Install

```shell
npm install fzip
```

## License

MIT

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