Permalink
Browse files

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 7b4f208d05b1ce5daee616108b90d1a7f40dbc42
Showing with 10 additions and 3 deletions.
  1. +10 −3 src/combineEpics.js
@@ -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.