Travis build: 1358 [cron]
This commit is contained in:
@ -1,6 +1,8 @@
|
||||
const invertKeyValues = obj =>
|
||||
const invertKeyValues = (obj, fn) =>
|
||||
Object.keys(obj).reduce((acc, key) => {
|
||||
acc[obj[key]] = key;
|
||||
const val = fn ? fn(obj[key]) : obj[key];
|
||||
acc[val] = acc[val] || [];
|
||||
acc[val].push(key);
|
||||
return acc;
|
||||
}, {});
|
||||
module.exports = invertKeyValues
|
||||
Reference in New Issue
Block a user