change(common/lmlayer): replace last index instead of pop/push

This commit is contained in:
Eddie Antonio Santos 2020-04-30 19:44:58 -06:00
parent 43c517ecc7
commit fb015fcf7a
No known key found for this signature in database
GPG key ID: DD411EA4D9509D87

View file

@ -63,9 +63,11 @@ namespace wordBreakers {
}
function concatLastSpanInStackWith(span: Span) {
let top = stack.pop();
let lastIndex = stack.length - 1;
let top = stack[lastIndex];
let joinedSpan = concatenateSpans(top, span);
stack.push(joinedSpan);
stack[lastIndex] = joinedSpan;
}
}