Last active
August 7, 2019 11:35
-
-
Save ConnectedReasoning/ac360d1617e2ddca9239daa5a316806e to your computer and use it in GitHub Desktop.
converts an array of items into an object containing name-value pairs with null as the value
This file contains hidden or 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
myObjectOfItems = myArray.reduce((obj, item) => { | |
obj[item['propertyToIsolate']] = null | |
return obj | |
}, {}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment