Skip to content

Instantly share code, notes, and snippets.

@telekosmos
Last active September 29, 2019 18:31
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 telekosmos/7b90ba76be6f9aa89882804dd64827e6 to your computer and use it in GitHub Desktop.
Save telekosmos/7b90ba76be6f9aa89882804dd64827e6 to your computer and use it in GitHub Desktop.
es6 - One level deep object flattening
const fn = ({ a, o }) => ({a, ...o});
const obj = { a:1, o: { b: 2, c: 3 } };
const r = fn(obj);
// r = { a: 1, b: 2, c: 3 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment