lodash.product
Version:
Calculates the Cartesian product between multiple collections.
2 lines (1 loc) • 451 B
JavaScript
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(require("lodash")):"function"==typeof define&&define.amd?define(["lodash"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self)._)}(this,(function(e){"use strict";e.mixin({product(...n){let t=[];return function(e){let n=function(...t){return e.call(this,n,...t)};return n}(((o,i)=>{i.length<n.length?e.forEach(n[i.length],(n=>{o(e.concat(i,[n]))})):t.push(i)}))([]),t}})}));