app/src/components/TermVis.js
/**
 * takes an array of timestamps and an array of frames and
 * maps the timestamps to the frame that represents that time
 */
takes an array of timestamps and an array of frames and
maps the timestamps to the frame that represents that time
takes an array of timestamps and an array of frames and maps the timestamps to the frame that represents that time
function timestampsToFrames(timestamps, frames) {
  let frameIndex = 0;
  const timestampFrames = timestamps.map(time => {
    while (frames[frameIndex]) {
      const frameStart = frames[frameIndex];
      const frameEnd = frames[frameIndex + 1];
      if (frameEnd === undefined) {
        return frameStart;
      } else if (frameStart <= time && time < frameEnd) {
        return frameStart;
      } else {
        frameIndex += 1;
      }
    }
    return null;
  });
  return timestampFrames;
}
function timestampsToFrames ( timestamps , frames ) { let frameIndex = 0 ; const timestampFrames = timestamps . map ( time => { while ( frames [ frameIndex ] ) { const frameStart = frames [ frameIndex ] ; const frameEnd = frames [ frameIndex + 1 ] ; if ( frameEnd === undefined ) { return frameStart ; } else if ( frameStart <= time && time < frameEnd ) { return frameStart ; } else { frameIndex += 1 ; } } return null ; } ) ; return timestampFrames ; }
takes an array of timestamps and an array of frames and
 maps the timestamps to the frame that represents that time
takes an array of timestamps and an array of frames and maps the timestamps to the frame that represents that time
// at the end of the frames // between this frame and the next // time is > frameEnd, so increment frames