one lazy hilarious thought on that though ...
On Mon, Aug 26, 2013 at 5:30 PM, Forbes Lindesay <[email protected]>wrote: > `String#split` already is iterable because it returns an array. What it > isn't is **lazy**. > > <https://mail.mozilla.org/listinfo/es-discuss> > > it's straight forward to make String#split(re) lazy using the `lastIndex` indeed: ```javascript function* lazySplit(str, re) { for (var i = 0; re.test(str); i = re.lastIndex ) yield str.slice( i, re.lastIndex - RegExp.lastMatch.length ) ; yield str.slice(i); } ``` There, Best Regards
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

