Skip to content

Instantly share code, notes, and snippets.

@monners
Created March 25, 2016 22:09
Show Gist options
  • Save monners/845aff42a00e474fff31 to your computer and use it in GitHub Desktop.
Save monners/845aff42a00e474fff31 to your computer and use it in GitHub Desktop.
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