Skip to content

Commit

Permalink
Avoid mimicFn error without try/catch (#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
fregante authored Oct 10, 2020
1 parent 3bbfa24 commit c1bba6e
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,9 @@ const mem = <
return result;
} as FunctionToMemoize;

try {
// The below call will throw in some host environments
// See https://github.com/sindresorhus/mimic-fn/issues/10
mimicFn(memoized, fn);
} catch {}
mimicFn(memoized, fn, {
ignoreNonConfigurable: true
});

cacheStore.set(memoized, cache);

Expand Down

0 comments on commit c1bba6e

Please sign in to comment.