Skip to content

Commit

Permalink
Remove extra typeof (ai#110)
Browse files Browse the repository at this point in the history
When `typeof` is used with unresolved reference, it swallows `ReferenceError` and returns `"undefined"`.
`attempt` binding is defined here, so it is safe to compare to `undefined` directly.
  • Loading branch information
shvaikalesh authored and ai committed Jan 4, 2019
1 parent 38f5bf8 commit 6860ca5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module.exports = function (size, attempt) {
try {
bytes = random(size)
} catch (e) {
if (typeof attempt === 'undefined') attempt = 3
if (attempt === undefined) attempt = 3
attempt -= 1
if (attempt === 0) {
throw e
Expand Down

0 comments on commit 6860ca5

Please sign in to comment.