Skip to content

Instantly share code, notes, and snippets.

@mpcowan
Last active January 13, 2020 02:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mpcowan/4574e6e1ea0edb321047733f982a7d16 to your computer and use it in GitHub Desktop.
Save mpcowan/4574e6e1ea0edb321047733f982a7d16 to your computer and use it in GitHub Desktop.
const normalizeActionType = (action) => {
const collapsable = [
'updateBoard',
'updateCard',
'updateList',
'updateChecklist'
];
if (collapsable.includes(action.type)) {
const updatedKeys = Object.keys(action.data.old);
if (updatedKeys.length > 0) {
return `${action.type}:${updatedKeys[0]}`;
}
}
return action.type;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment