Skip to content

Commit

Permalink
feat(combineEpics): verbose combineEpics returned function name
Browse files Browse the repository at this point in the history
Combined functions always return `<anonymous>` which is not very useful. This Commit updates the name of the combined epics to the following:

> combineEpics(epic1, epic2)

style(combineEpics): shorter code

style(combineEpics): fix linting

fallback to '<anonymous>'
  • Loading branch information
Bamieh committed Apr 19, 2018
1 parent fab9c1d commit d596df7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/combineEpics.js
Expand Up @@ -3,8 +3,8 @@ import { merge } from 'rxjs';
/**
Merges all epics into a single one.
*/
export const combineEpics = (...epics) => (...args) =>
merge(
export const combineEpics = (...epics) => {
const merger = (...args) => merge(
...epics.map(epic => {
const output$ = epic(...args);
if (!output$) {
Expand All @@ -13,3 +13,8 @@ export const combineEpics = (...epics) => (...args) =>
return output$;
})
);

return Object.defineProperty(merger, 'name', {
value: `combineEpics(${epics.map(epic => epic.name || '<anonymous>').join(', ')})`,
});
};

0 comments on commit d596df7

Please sign in to comment.