@extra-array/cartesian-product.min
Version:
Lists cartesian product of arrays.
1 lines • 1.13 kB
JavaScript
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).array_cartesianProduct=e()}}(function(){return function(){return function e(r,n,t){function o(u,i){if(!n[u]){if(!r[u]){var l="function"==typeof require&&require;if(!i&&l)return l(u,!0);if(f)return f(u,!0);var a=new Error("Cannot find module '"+u+"'");throw a.code="MODULE_NOT_FOUND",a}var d=n[u]={exports:{}};r[u][0].call(d.exports,function(e){return o(r[u][1][e]||e)},d,d.exports,e,r,n,t)}return n[u].exports}for(var f="function"==typeof require&&require,u=0;u<t.length;u++)o(t[u]);return o}}()({1:[function(e,r,n){"use strict";function t(e){return e}r.exports=function(e,r=null){r=r||t;var n=e.length,o=[];if(0===n)return o;var f=new Array(n).fill(0),u=e.map(e=>e.length);if(u.some(e=>0===e))return o;for(var i=0;;i++){for(var l=0,a=[];l<n;l++)a.push(e[l][f[l]]);o.push(r(a,i,null));for(var d=n-1;d>=0&&!(++f[d]<u[d]);d--)f[d]=0;if(d<0)break}return o}},{}]},{},[1])(1)});