16fe912fbd
Co-authored-by: Nithin David Thomas <webofnithin@gmail.com> Co-authored-by: Sojan Jose <sojan@pepalo.com>
10 lines
300 B
JavaScript
Executable file
10 lines
300 B
JavaScript
Executable file
/* eslint-disable import/prefer-default-export */
|
|
export const isEmptyObject = obj =>
|
|
Object.keys(obj).length === 0 && obj.constructor === Object;
|
|
|
|
export const arrayToHashById = array =>
|
|
array.reduce((map, obj) => {
|
|
const newMap = map;
|
|
newMap[obj.id] = obj;
|
|
return newMap;
|
|
}, {});
|