Distinguish input from output emptyLevels in mapLevels
This commit is contained in:
parent
a5c80092cd
commit
c5eab99565
12
route.js
12
route.js
|
@ -1326,15 +1326,15 @@ function Routing(exports) {
|
||||||
return this.mapZip(path, Math.max, straightGestaltLevelOp(erasePath));
|
return this.mapZip(path, Math.max, straightGestaltLevelOp(erasePath));
|
||||||
};
|
};
|
||||||
|
|
||||||
function mapLevels(inputMetaLevels, f, emptyCheck, emptyLevel) {
|
function mapLevels(inputMetaLevels, f, emptyCheck, inputEmptyLevel, outputEmptyLevel) {
|
||||||
var outputMetaLevels = [];
|
var outputMetaLevels = [];
|
||||||
for (var i = 0; i < inputMetaLevels.length; i++) {
|
for (var i = 0; i < inputMetaLevels.length; i++) {
|
||||||
var ls = inputMetaLevels[i];
|
var ls = inputMetaLevels[i];
|
||||||
var levels = [];
|
var levels = [];
|
||||||
for (var j = 0; j < ls.length; j++) {
|
for (var j = 0; j < ls.length; j++) {
|
||||||
var p = f(ls[j] || emptyLevel);
|
var p = f(ls[j] || inputEmptyLevel);
|
||||||
if (!emptyCheck(p)) {
|
if (!emptyCheck(p)) {
|
||||||
while (levels.length < j) levels.push(emptyLevel);
|
while (levels.length < j) levels.push(outputEmptyLevel);
|
||||||
levels.push(p);
|
levels.push(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1351,7 +1351,7 @@ function Routing(exports) {
|
||||||
return new GestaltLevel(f(p.subscriptions), f(p.advertisements));
|
return new GestaltLevel(f(p.subscriptions), f(p.advertisements));
|
||||||
}, function (p) {
|
}, function (p) {
|
||||||
return p.isEmpty();
|
return p.isEmpty();
|
||||||
}, emptyLevel));
|
}, emptyLevel, emptyLevel));
|
||||||
};
|
};
|
||||||
|
|
||||||
Gestalt.prototype.stripLabel = function () {
|
Gestalt.prototype.stripLabel = function () {
|
||||||
|
@ -1389,7 +1389,7 @@ function Routing(exports) {
|
||||||
serializeMatcher(p.advertisements, serializeSuccess)];
|
serializeMatcher(p.advertisements, serializeSuccess)];
|
||||||
}, function (pr) {
|
}, function (pr) {
|
||||||
return pr.length === 2 && pr[0].length === 0 && pr[1].length === 0;
|
return pr.length === 2 && pr[0].length === 0 && pr[1].length === 0;
|
||||||
}, [[],[]])];
|
}, emptyLevel, [[],[]])];
|
||||||
};
|
};
|
||||||
|
|
||||||
function deserializeGestalt(r) {
|
function deserializeGestalt(r) {
|
||||||
|
@ -1400,7 +1400,7 @@ function Routing(exports) {
|
||||||
deserializeMatcher(pr[1], deserializeSuccess));
|
deserializeMatcher(pr[1], deserializeSuccess));
|
||||||
}, function (p) {
|
}, function (p) {
|
||||||
return p.isEmpty();
|
return p.isEmpty();
|
||||||
}, emptyLevel));
|
}, [[],[]], emptyLevel));
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
Loading…
Reference in New Issue