Last active
April 9, 2017 12:22
-
-
Save slikts/70b3eb01ddb025429cb585b808c50b14 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LazyArray extends Array { | |
constructor() { | |
super() | |
this[Array.species] = new.target | |
} | |
*lazyMap(fn) { | |
for (let i = 0; i < this.length; i++) { | |
yield fn(this[i]) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment