in 2019/functional/functionalTest.js [537:565]
function search() {
return reader.read().then(function(result) {
var chunk = result.value;
for (var i = 3; i < chunk.byteLength; i++) {
partialCell += String.fromCharCode(chunk[i]);
}
var cellBoundry = /(?:,|\r\n)/;
var completeCells = partialCell.split(cellBoundry);
if (!result.done) {
// last cell may not be complete
partialCell = completeCells[completeCells.length - 1];
completeCells = completeCells.slice(0, -1);
}
for (var cell of completeCells) {
cell = cell.trim();
if (returnNextCell) {
reader.cancel("No more reading needed.");
return cell;
}
if (cell === returnCellAfter) {
returnNextCell = true;
}
}
if (result.done) {
throw Error("Could not find value after " + returnCellAfter);
}
return search();
});
}