Created
January 26, 2016 09:09
-
-
Save bendc/8041f7144a7e3b667ea8 to your computer and use it in GitHub Desktop.
Make objects iterable
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
const iterable = function* (obj) { | |
yield* Object.keys(obj).map(key => [key, obj[key]]); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example: