Last active
January 23, 2017 19:26
-
-
Save marc-rutkowski/e671ebbb4563af0a1c4c to your computer and use it in GitHub Desktop.
Revisions
-
marc-rutkowski created this gist
Mar 12, 2016 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,8 @@ const isUnique = (value, index, self) => self.indexOf(value) === index; const unique = items => items.filter(isUnique); const mapBy = (items, key) => items.map(item => item[key]); const uniqueKeys = (items, key) => unique(mapBy(items, key)); const someKeys = (item, keys) => keys.reduce((result, key) => { result[key] = item[key]; return result; }, {});