rfcs icon indicating copy to clipboard operation
rfcs copied to clipboard

each vs each-in

Open NullVoxPopuli opened this issue 6 months ago • 1 comments
trafficstars

See existing behavior of each vs each-in

Is there a good reason to not have each just... do everything?

  • handle non-arrays (call .entries() or Object.entries())
  • continue to yield out the index as the last param (each-in does not do this)

NullVoxPopuli avatar May 07 '25 21:05 NullVoxPopuli

just the same reasoning you don't have .forEach on Object https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object they are different, do different things as you pointed out one of them doesn't have indexes you can pretend it does, but only a derived state like entries has them as that is not guaranteed to be stable other examples for..in and for..of they are separate things

void-mAlex avatar May 08 '25 11:05 void-mAlex