Skip to content
This repository has been archived by the owner on Apr 1, 2023. It is now read-only.

Latest commit

 

History

History
48 lines (38 loc) · 2.06 KB

mix.md

File metadata and controls

48 lines (38 loc) · 2.06 KB

Object Agent

A javascript library for working with objects

npm build coverage deps size vulnerabilities license


mix(args) ⇒ Array

Mix the contents of multiple arrays into a nested array where all variations of one item from each array is in each of the nested arrays.

Param Type Description
args Array All of the arrays to mix together

Example

import { mix } from 'object-agent';

mix([1, 2, 3], ['a', 'b', 'c']);
// => [[1, 'a'], [1, 'b'], [1, 'c'], [2, 'a'], [2, 'b'], [2, 'c'], [3, 'a'], [3, 'b'], [3, 'c']]

mix([1, 2],  ['a', 'b'],  ['x', 'y']);
// => [[1, 'a', 'x'], [1, 'a', 'y'], [1, 'b', 'x'], [1, 'b', 'y'], [2, 'a', 'x'], [2, 'a', 'y'], [2, 'b', 'x'], [2, 'b', 'y']]