src/utils/pause/frames/annotateFrames.js
function getBabelFrameIndexes(frames) {
  const startIndexes = frames.reduce((accumulator, frame, index) => {
    if (
      getFrameUrl(frame).match(/regenerator-runtime/i) &&
      frame.displayName === "tryCatch"
    ) {
      return [...accumulator, index];
    }
    return accumulator;
  }, []);

  const endIndexes = frames.reduce((accumulator, frame, index) => {
    if (
      getFrameUrl(frame).match(/_microtask/i) &&
      frame.displayName === "flush"
    ) {
      return [...accumulator, index];
    }
    if (frame.displayName === "_asyncToGenerator/<") {
      return [...accumulator, index + 1];
    }
    return accumulator;
  }, []);

  if (startIndexes.length != endIndexes.length || startIndexes.length === 0) {
    return frames;
  }

  // Receives an array of start and end index tuples and returns
  // an array of async call stack index ranges.
  // e.g. [[1,3], [5,7]] => [[1,2,3], [5,6,7]]
  // $FlowIgnore
  return flatMap(zip(startIndexes, endIndexes), ([startIndex, endIndex]) =>
    range(startIndex, endIndex + 1)
  );
}
function getBabelFrameIndexes(frames) {
  const startIndexes = frames.reduce((accumulator, frame, index) => {
    if (
      getFrameUrl(frame).match(/regenerator-runtime/i) &&
      frame.displayName === "tryCatch"
    ) {
      return [...accumulator, index];
    }
    return accumulator;
  }, []);

  const endIndexes = frames.reduce((accumulator, frame, index) => {
    if (
      getFrameUrl(frame).match(/_microtask/i) &&
      frame.displayName === "flush"
    ) {
      return [...accumulator, index];
    }
    if (frame.displayName === "_asyncToGenerator/<") {
      return [...accumulator, index + 1];
    }
    return accumulator;
  }, []);

  if (startIndexes.length != endIndexes.length || startIndexes.length === 0) {
    return frames;
  }

  // Receives an array of start and end index tuples and returns
  // an array of async call stack index ranges.
  // e.g. [[1,3], [5,7]] => [[1,2,3], [5,6,7]]
  // $FlowIgnore
  return flatMap(zip(startIndexes, endIndexes), ([startIndex, endIndex]) =>
    range(startIndex, endIndex + 1)
  );
}
function getBabelFrameIndexes ( frames ) { const startIndexes = frames . reduce ( ( accumulator , frame , index ) => { if ( getFrameUrl ( frame ) . match ( / regenerator-runtime / i ) && frame . displayName === "tryCatch" ) { return [ ... accumulator , index ] ; } return accumulator ; } , [ ] ) ; const endIndexes = frames . reduce ( ( accumulator , frame , index ) => { if ( getFrameUrl ( frame ) . match ( / _microtask / i ) && frame . displayName === "flush" ) { return [ ... accumulator , index ] ; } if ( frame . displayName === "_asyncToGenerator/<" ) { return [ ... accumulator , index + 1 ] ; } return accumulator ; } , [ ] ) ; if ( startIndexes . length != endIndexes . length || startIndexes . length === 0 ) { return frames ; } // Receives an array of start and end index tuples and returns // an array of async call stack index ranges. // e.g. [[1,3], [5,7]] => [[1,2,3], [5,6,7]] // $FlowIgnore return flatMap ( zip ( startIndexes , endIndexes ) , ( [ startIndex , endIndex ] ) => range ( startIndex , endIndex + 1 ) ) ; }
Receives an array of frames and looks for babel async call stack groups.
Receives an array of frames and looks for babel async call stack groups .