Js笛卡尔乘积
self.getDescartesSku = function (selSaleProp, i, nowLst, allALst) {
if (selSaleProp.length == 0) {
return;
}
if (i == selSaleProp.length - 1) {
for (var tempi = 0; tempi < selSaleProp[i].values.length; tempi++) {
var tempA = nowLst.concat(selSaleProp[i].values[tempi]);
allALst.push({ SaleProps: tempA });
}
} else {
for (var tempi = 0; tempi < selSaleProp[i].values.length; tempi++) {
var tempA = nowLst.concat(selSaleProp[i].values[tempi]);
self.getDescartesSku(selSaleProp, (i + 1), tempA, allALst);
}
}
};
if (selSaleProp.length == 0) {
return;
}
if (i == selSaleProp.length - 1) {
for (var tempi = 0; tempi < selSaleProp[i].values.length; tempi++) {
var tempA = nowLst.concat(selSaleProp[i].values[tempi]);
allALst.push({ SaleProps: tempA });
}
} else {
for (var tempi = 0; tempi < selSaleProp[i].values.length; tempi++) {
var tempA = nowLst.concat(selSaleProp[i].values[tempi]);
self.getDescartesSku(selSaleProp, (i + 1), tempA, allALst);
}
}
};
版权声明:本文为博主原创文章,未经博主允许不得转载。