Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return (dispatch, getState) => {
const fonts = fontSelector(getState());
const fontData = (fonts[type] && fonts[type].data) || [];
const dataFonts = {
[`${type}`]: {
data: fontData.map(font =>
removedFonts.some(({ brizyId }) => brizyId === font.brizyId)
? { ...font, deleted: true }
: font
)
}
};
return dispatch({
type: DELETE_FONTS,
payload: mergeDeep(fonts, dataFonts)
});
};
}
...acc,
[`${type}`]: {
data: fontData
.map(
font =>
deletedFonts.find(({ brizyId }) => font.brizyId === brizyId) ||
font
)
.concat(newFonts)
}
};
}, {});
return dispatch({
type: ADD_FONTS,
payload: mergeDeep(usedFonts, newFonts)
});
};
}