News for hackers. Stuff that matters.
Re:Why Would Anyone Need JavaScript Generator Functions? by mdaniel on Monday November 07, 2022 @11:42AM (#33508228)
I'll bite: why the anonymous function throwing an Error in the first snippet?
Re:Why Would Anyone Need JavaScript Generator Functions? by aastronaut on Monday November 07, 2022 @12:36PM (#33509139)
I didn't lay out a bait =)

It would also look more readable to me with a default return value. An exhaustiveness check just keeps your mapping functionally pure and the type checker can catch it.