# cartesian

> Computes the cartesian product of arrays provided by an array or an object

Latest version **1.0.1** (published 2016-12-08) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2016-12-08 |
| First published | 2015-12-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 23 |
| Author | Alex Indigo |
| Maintainers | alexindigo |
| Keywords | cartesian, cartesian product, array, object, properties, permutation, combination |

## Links

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

## Dependencies (1)

- [xtend](https://npm.io/package/xtend.md) ^4.0.1

## Recent versions

- 1.0.1 (latest) — 2016-12-08
- 1.0.0 — 2015-12-02

## README

# Cartesian
Computes the cartesian product of arrays provided by an array or an object

[![Build Status](https://img.shields.io/travis/alexindigo/cartesian/master.svg?style=flat-square)](https://travis-ci.org/alexindigo/cartesian)
[![Coverage Status](https://img.shields.io/coveralls/alexindigo/cartesian/master.svg?style=flat-square)](https://coveralls.io/github/alexindigo/cartesian?branch=master)

## Install

```
npm install cartesian --save
```

## Examples

```javascript
var cartesian = require('cartesian');
```

### Array or arrays:

```javascript
cartesian([
  ['A', 'B', 'C'],
  ['M'],
  ['X', 'Y'],
  'Z'
]);

// =>
// [
//   [ 'A', 'M', 'X', 'Z' ],
//   [ 'A', 'M', 'Y', 'Z' ],
//   [ 'B', 'M', 'X', 'Z' ],
//   [ 'B', 'M', 'Y', 'Z' ],
//   [ 'C', 'M', 'X', 'Z' ],
//   [ 'C', 'M', 'Y', 'Z' ]
// ]
```

### Object with array properties:

```javascript
cartesian({
  cdn  : ['image1', 'image2'],
  path : '/dir',
  files: ['file1', 'file2', 'file3']
});

// =>
// [
//   { cdn: 'image1', path: '/dir', files: 'file1' },
//   { cdn: 'image1', path: '/dir', files: 'file2' },
//   { cdn: 'image1', path: '/dir', files: 'file3' },
//   { cdn: 'image2', path: '/dir', files: 'file1' },
//   { cdn: 'image2', path: '/dir', files: 'file2' },
//   { cdn: 'image2', path: '/dir', files: 'file3' }
// ]
```

For more examples check out [`test.js`](test.js).

## License

[MIT](LICENSE)

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