# keymbinatorial

> Module that generates the unique combinations of key values by taking a single value from each keys array

Latest version **3.0.0** (published 2025-02-27) · BSD-3-Clause license · 0 weekly downloads

## Install

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

## Health

**Score 25/100 (F)** — status: maintenance-mode.

Positive: no vulnerabilities.

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

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2025-02-27 |
| First published | 2016-07-18 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 7.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Noah Katzman |
| Maintainers | screwdriver, nokatzhere |
| Keywords | screwdriver, yahoo, combinations, combinatorial |

## Links

- npm: https://www.npmjs.com/package/keymbinatorial
- Repository: https://github.com/screwdriver-cd/keymbinatorial
- Issues: https://github.com/screwdriver-cd/screwdriver/issues
- npm.io page: https://npm.io/package/keymbinatorial

## Dependencies (2)

- [joi](https://npm.io/package/joi.md) ^17.7.0
- [clone](https://npm.io/package/clone.md) ^2.1.2

## Recent versions

- 3.0.0 (latest) — 2025-02-27
- 2.0.0 — 2022-11-21
- 1.2.0 — 2021-07-09
- 1.1.6 — 2020-12-03
- 1.1.5 — 2019-01-09
- 1.1.4 — 2018-02-20
- 1.1.3 — 2018-02-20
- 1.1.2 — 2018-02-20
- 1.1.1 — 2017-01-05
- 1.1.0 — 2016-12-20
- 1.0.5 — 2016-12-06
- 1.0.4 — 2016-10-29
- 1.0.3 — 2016-10-10
- 1.0.2 — 2016-08-11
- 1.0.1 — 2016-08-02
- … 3 more at https://npm.io/package/keymbinatorial/versions

## README

# Keymbinatorial
[![Version][npm-image]][npm-url] ![Downloads][downloads-image] [![Build Status][status-image]][status-url] [![Open Issues][issues-image]][issues-url] ![License][license-image]

> Generates a unique combinations of key values by taking a single value from each keys array

## Usage

```bash
npm install keymbinatorial
```

```js
var keymbinatorial = require('keymbinatorial');

let objectToCombine = {
    a: ['a', 'b', 'c'],
    c: [1, 2],
    e: [{ a: '1'}, {b: '2'}]
};

// combinations will be an array of unique combinations based on each key and the values in the array
let combinations = keymbinatorial(objectToCombine);

console.log(combinations);
/*
will output:
[
  { a: 'a', c: 1, e: { a: '1' } },
  { a: 'a', c: 1, e: { b: '2' } },
  { a: 'a', c: 2, e: { a: '1' } },
  { a: 'a', c: 2, e: { b: '2' } },
  { a: 'b', c: 1, e: { a: '1' } },
  { a: 'b', c: 1, e: { b: '2' } },
  { a: 'b', c: 2, e: { a: '1' } },
  { a: 'b', c: 2, e: { b: '2' } },
  { a: 'c', c: 1, e: { a: '1' } },
  { a: 'c', c: 1, e: { b: '2' } },
  { a: 'c', c: 2, e: { a: '1' } },
  { a: 'c', c: 2, e: { b: '2' } }
]
*/
```

The `keymbinatorial` function takes in an Nx1 object, where N is a set of keys that map to
an array.

For each key in the object, the function builds up a list of objects containing a unique combination
of keys to values in the array.

## Testing

```bash
npm test
```

## License

Code licensed under the BSD 3-Clause license. See LICENSE file for terms.

[npm-image]: https://img.shields.io/npm/v/keymbinatorial.svg
[npm-url]: https://npmjs.org/package/keymbinatorial
[downloads-image]: https://img.shields.io/npm/dt/keymbinatorial.svg
[license-image]: https://img.shields.io/npm/l/keymbinatorial.svg
[issues-image]: https://img.shields.io/github/issues/screwdriver-cd/screwdriver.svg
[issues-url]: https://github.com/screwdriver-cd/screwdriver/issues
[status-image]: https://cd.screwdriver.cd/pipelines/20/badge
[status-url]: https://cd.screwdriver.cd/pipelines/20

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