Files
freeCodeCamp/common/utils/get-actions-of-type.js
2016-08-03 15:51:28 -07:00

11 lines
266 B
JavaScript

export default function getActionsOfType(actions, ...types) {
const length = types.length;
return actions
.filter(({ type }) => {
if (length === 1) {
return type === types[0];
}
return types.some(_type => _type === type);
});
}