Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save indongyoo/0d5eabc5dac9b9bec23adb3ffdc3780f to your computer and use it in GitHub Desktop.
Save indongyoo/0d5eabc5dac9b9bec23adb3ffdc3780f to your computer and use it in GitHub Desktop.
function *valuesIter(obj) {
for (const key in obj) yield obj[key];
}
const users = {
5: { id: 5, name: 'YB' },
19: { id: 19, name: 'BX' },
27: { id: 27, name: 'MD' }
};
for (const val of valuesIter(users)) log(val.name);
// YB
// BX
// MD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment