my-idlers/node_modules/collect.js/docs/api/crossJoin.md
cp6 fd22b0bf58 V2 (Laravel re-make)
V2 (Laravel re-make)
2022-03-06 02:02:12 +11:00

420 B

crossJoin()

The crossJoin method cross joins the collection with the given array or collection, returning all possible permutations:

const collection = collect([1, 2]);

const joined = collection.crossJoin(['a', 'b']);

joined.all();

// [
//   [1, 'a'],
//   [1, 'b'],
//   [2, 'a'],
//   [2, 'b'],
// ]

View source on GitHub