Letting RegExp method return something iterable?
domenic at domenicdenicola.com
Sat Aug 24 13:48:57 PDT 2013
This is really nice. lastIndex silliness in ES5 has bitten me quite a few times, and the example code shows how much better this would be. I hope someone on TC39 wants to champion this!
From: es-discuss [mailto:es-discuss-bounces at mozilla.org] On Behalf Of Axel Rauschmayer
Sent: Saturday, August 24, 2013 16:45
To: es-discuss list
Subject: Re: Letting RegExp method return something iterable?
An example to make things clearer (thanks for the suggestion, Domenic):
On Aug 24, 2013, at 21:43 , Axel Rauschmayer <axel at rauschma.de<mailto:axel at rauschma.de>> wrote:
Well, obviously it doesn’t make much sense to do that for `text()`, but it would be great to have for `exec()`.
On Aug 24, 2013, at 21:39 , Axel Rauschmayer <axel at rauschma.de<mailto:axel at rauschma.de>> wrote:
At the moment, the following two methods abuse regular expressions as iterators (if the /g flag is set):
Would it make sense to create similar methods that return something iterable, so that for-of can iterate over the result?
Dr. Axel Rauschmayer
axel at rauschma.de<mailto:axel at rauschma.de>
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss