![]() Server : Apache/2 System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64 User : gositeme ( 1004) PHP Version : 8.2.29 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname Directory : /home/gositeme/domains/lavocat.quebec/private_html/node_modules/d3-array/src/ |
function length(array) {
return array.length | 0;
}
function empty(length) {
return !(length > 0);
}
function arrayify(values) {
return typeof values !== "object" || "length" in values ? values : Array.from(values);
}
function reducer(reduce) {
return values => reduce(...values);
}
export default function cross(...values) {
const reduce = typeof values[values.length - 1] === "function" && reducer(values.pop());
values = values.map(arrayify);
const lengths = values.map(length);
const j = values.length - 1;
const index = new Array(j + 1).fill(0);
const product = [];
if (j < 0 || lengths.some(empty)) return product;
while (true) {
product.push(index.map((j, i) => values[i][j]));
let i = j;
while (++index[i] === lengths[i]) {
if (i === 0) return reduce ? product.map(reduce) : product;
index[i--] = 0;
}
}
}