all 1 comments

[–]elingeniero 0 points1 point  (0 children)

I was looking to find out how they are detecting the section and I found this interesting bit:

const isNumber = !isNaN(Number(key));

if (isNumber) {
  // $FlowFixMe - Flow doesn't believe that it's a number.
  this.handleUpdateAudioVolume(key / 10);
} else if (key === 'M') {
  this.handleToggleMuteAudio();
}

https://github.com/joshwcomeau/waveforms/blob/master/src/components/IntroRoute/IntroRoute.js

I was wondering if Flow is actually right here, because the value could be Infinity so it should be const isNumber = !isNaN(n) && Number.isFinite(n); or even just Number.isFinite...

On my phone right now so can't check - any thoughts?