packages/flow-remove-types/index.js
// Returns true if node is the last to be removed from a line.
Returns true if node is the last to be removed from a line.
Returns true if node is the last to be removed from a line .
function isLastNodeRemovedFromLine(context, node) {
  var tokens = context.ast.tokens;
  var priorTokenIdx = findTokenIndex(tokens, startOf(node)) - 1;
  var token = tokens[priorTokenIdx];
  var line = node.loc.end.line;
  while (
    priorTokenIdx >= 0 &&
    token.loc.end.line === line &&
    isRemovedToken(context, token)
  ) {
    token = tokens[--priorTokenIdx];
  }
  return !token || token.loc.end.line !== line;
}
function isLastNodeRemovedFromLine ( context , node ) { var tokens = context . ast . tokens ; var priorTokenIdx = findTokenIndex ( tokens , startOf ( node ) ) - 1 ; var token = tokens [ priorTokenIdx ] ; var line = node . loc . end . line ; while ( priorTokenIdx >= 0 && token . loc . end . line === line && isRemovedToken ( context , token ) ) { token = tokens [ -- priorTokenIdx ] ; } return ! token || token . loc . end . line !== line ; }
Returns true if node is the last to be removed from a line.
Returns true if node is the last to be removed from a line .
// Find previous token that was not removed on the same line. // If there's no prior token (start of file), or the prior token is on another // line, this line must be fully removed.