# mobik

> 273 Bytes Array utility for merging an array of objects by a given key

Latest version **1.1.0** (published 2018-12-06) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2018-12-06 |
| First published | 2018-12-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Nicola Zanon |
| Maintainers | zanonnicola |
| Keywords | js, library, array, utility |

## Links

- npm: https://www.npmjs.com/package/mobik
- Repository: https://github.com/zanonnicola/mobik
- Homepage: https://github.com/zanonnicola/mobik#readme
- Issues: https://github.com/zanonnicola/mobik/issues
- npm.io page: https://npm.io/package/mobik

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.1.0 (latest) — 2018-12-06
- 1.0.2 — 2018-12-06
- 1.0.1 — 2018-12-05
- 1.0.0 — 2018-12-05

## README

<p align="center">
  <img src="https://i.ibb.co/xXcKJnn/mobik.jpg" width="597" alt="MOBIK">
</p>

# Mobik

Fast **273 bytes** `Array` utility for merging an array of objects by a given key.

## :package: Installation

```bash
npm install mobik --save
```

## :rocket: Load

```js
// using es modules
import mobik from 'mobik'

// common.js
const mobik = require('mobik')

```

Or use script tags and globals.

```html
<script src="https://unpkg.com/mobik"></script>
```

And then grab it off the global like so:

```js
const mobik = mobik.default;
```

## :bulb: Usage

Let's assume you want to group a set of objects in an array by key 

```javascript
const newArray = mobik('a', [{a: 1, b: 2}, {c: 3, a: 1}]);

/*
[
  {
    a: 1,
    b: 2,
    c: 3
  }
]
*/
```

> It works with nested objects too!

```javascript
const newArray = mobik('a', [{a: 1, b: 2}, {c: {d: 4}, a: 1}]);

/*
[
  {
    a: 1,
    b: 2,
    c: {
      d: 4
    }
  }
]
*/
```

## API

#### `mobik(key: String, array: Array)` [required]

Returns an `Array` with a merged `Object`

OR `[]` when no key is found.

## Tests

`npm test`

## Legal

Released under MIT license.

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