Last active
September 29, 2019 18:31
-
-
Save telekosmos/7b90ba76be6f9aa89882804dd64827e6 to your computer and use it in GitHub Desktop.
es6 - One level deep object flattening
This file contains 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 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