diff options
author | Graeme Yeates <gyeates@clearpath.ai> | 2017-04-17 14:07:58 -0400 |
---|---|---|
committer | Graeme Yeates <gyeates@clearpath.ai> | 2017-04-17 14:07:58 -0400 |
commit | 6d19dd3013480aa0ed7a025ee179fc499c255fca (patch) | |
tree | ee8686b7fb9d5ef5a9e25eb9e244f490d597d97d /lib/internal | |
parent | 81d66dd219f62bb24fc3ca684236bdddc4cc4267 (diff) | |
download | async-6d19dd3013480aa0ed7a025ee179fc499c255fca.tar.gz |
Avoid eval in async wrappers; fixes #1403
Diffstat (limited to 'lib/internal')
-rw-r--r-- | lib/internal/wrapAsync.js | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/lib/internal/wrapAsync.js b/lib/internal/wrapAsync.js index aee0275..c4d1ea8 100644 --- a/lib/internal/wrapAsync.js +++ b/lib/internal/wrapAsync.js @@ -1,19 +1,7 @@ -import identity from 'lodash/identity'; import asyncify from '../asyncify'; var supportsSymbol = typeof Symbol === 'function'; -function supportsAsync() { - var supported; - try { - /* eslint no-eval: 0 */ - supported = isAsync(eval('(async function () {})')); - } catch (e) { - supported = false; - } - return supported; -} - function isAsync(fn) { return supportsSymbol && fn[Symbol.toStringTag] === 'AsyncFunction'; } @@ -22,6 +10,6 @@ function wrapAsync(asyncFn) { return isAsync(asyncFn) ? asyncify(asyncFn) : asyncFn; } -export default supportsAsync() ? wrapAsync : identity; +export default wrapAsync; -export { supportsAsync, isAsync }; +export { isAsync }; |