in packages/flow-remove-types/index.js [106:137]
toString: function () {
if (!removedNodes || removedNodes.length === 0) {
return source;
}
var result = '';
var lastPos = 0;
// Step through the removed nodes, building up the resulting string.
for (var i = 0; i < removedNodes.length; i++) {
var node = removedNodes[i];
result += source.slice(lastPos, startOf(node));
lastPos = endOf(node);
if (typeof node.__spliceValue === 'string') {
result += node.__spliceValue;
}
if (!pretty) {
var toReplace = source.slice(startOf(node), endOf(node));
if (!node.loc || node.loc.start.line === node.loc.end.line) {
result += space(toReplace.length);
} else {
var toReplaceLines = toReplace.split(LINE_RX);
result += space(toReplaceLines[0].length);
for (var j = 1; j < toReplaceLines.length; j += 2) {
result += toReplaceLines[j] + space(toReplaceLines[j + 1].length);
}
}
}
}
return (result += source.slice(lastPos));
},