chatwoot/app/javascript/widget/helpers/utils.js
Pranav Raj S 16fe912fbd
[Feature] Website live chat (#187)
Co-authored-by: Nithin David Thomas <[email protected]>
Co-authored-by: Sojan Jose <[email protected]>
2019-10-29 12:50:54 +05:30

11 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;
}, {});