npm

Share private packages across your team with npm Orgs, now with simplified billing via the aws marketplace!Learn more »

lodash.product

18.9.19 • Public • Published

lodash.product

_.product(...collections)

Calculates the Cartesian product between multiple collections.

argument description
collections Collections to calculate the Cartesian product from.

Returns a new array.

dependencies

setup

npm

npm install lodash.product

ES module

import 'lodash.product';
import _ from 'lodash';

Node

require('lodash.product');
let _ = require('lodash');

browser

<script src="https://unpkg.com/lodash"></script>
<script src="https://unpkg.com/lodash.product"></script>

usage

let product = _.product([false, true], ['a', 'b', 'c'], [{}]);
// => [[false, 'a', {}], [false, 'b', {}], [false, 'c', {}], [true, 'a', {}], [true, 'b', {}], [true, 'c', {}]]

let array = [1, 2, 3];
let product = _.product(array, array);
// => [[1, 1], [1, 2], [1, 3], [2, 1], [2, 2], [2, 3], [3, 1], [3, 2], [3, 3]]

install

npm i lodash.product

Downloadsweekly downloads

1,205

version

18.9.19

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability