Created
September 21, 2015 18:24
-
-
Save TCotton/155e18ea58397a5ff105 to your computer and use it in GitHub Desktop.
Plain objects are not iterable in ES6—that would clash with iterability of data structures. Helper is easy to write.
This file contains hidden or 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
| //Plain objects are not iterable in ES6—that would clash with iterability of data structures. Helper is easy to write. | |
| function* objectEntries(obj) { | |
| let keys = Reflect.ownKeys(obj); | |
| for (let key of keys) { | |
| yield [key, obj[key]]; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment