Created
January 30, 2020 10:44
-
-
Save Ivannnnn/30355f364b40b25f946df8015bdf2fbc to your computer and use it in GitHub Desktop.
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
function keyBy(collection, key) { | |
const result = {} | |
collection.forEach(item => result[item[key]] = item) | |
return result | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment