‘matchAll’ looks great but why make it an iterator vs a ‘map’ style callback? Just seems so arcane.
Because that makes it significantly easier to e.g. optionally collect into an array, or to only partially iterate the sequence (e.g. only get the first 3 matches) which is painful to impossible using JS's callbacks. An iterator is simply more flexible.
[0] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...