Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix(combineEpics): combineEpics no longer errors on React Native Andr…
…oid because of readonly `name` prop setting
  • Loading branch information
jayphelps committed Jun 4, 2018
1 parent db3b513 commit 7b4f208
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/combineEpics.js
Expand Up @@ -14,7 +14,14 @@ export const combineEpics = (...epics) => {
})
);

return Object.defineProperty(merger, 'name', {
value: `combineEpics(${epics.map(epic => epic.name || '<anonymous>').join(', ')})`,
});
// Technically the `name` property on Function's are supposed to be read-only.
// While some JS runtimes allow it anyway (so this is useful in debugging)
// some actually throw an exception when you attempt to do so.
try {
Object.defineProperty(merger, 'name', {
value: `combineEpics(${epics.map(epic => epic.name || '<anonymous>').join(', ')})`,
});
} catch (e) {}

return merger;
};

0 comments on commit 7b4f208

Please sign in to comment.