Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Utility function for making Objects iterable
function makeObjectIterable (obj) {
obj[Symbol.iterator] = function *() {
let properties = Object.keys(this);
for (let p of properties) {
yield this[p];
}
}
return obj;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment