Last active
August 15, 2017 15:16
-
-
Save zburgermeiszter/203ac7afb75577e0faae39b4b512d83f to your computer and use it in GitHub Desktop.
ES6 destructuring magic
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
Modify object property in a list of object. | |
[{n: 1},{n: 2}].map(({n}) => ({n:n*2})) | |
But it break the structure: | |
[{n: 1, m:0},{n: 2,m:0}].map(({n}) => ({n:n*2})) | |
More: https://gist.github.com/mikaelbr/9900818 | |
https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment