Skip to content

Commit

Permalink
[refactor] default: replace .some wtih .find
Browse files Browse the repository at this point in the history
  • Loading branch information
golopot committed Sep 4, 2019
1 parent cba9218 commit 0b1ced8
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/rules/default.js
Expand Up @@ -13,14 +13,9 @@ module.exports = {

function checkDefault(specifierType, node) {

// poor man's Array.find
let defaultSpecifier
node.specifiers.some((n) => {
if (n.type === specifierType) {
defaultSpecifier = n
return true
}
})
const defaultSpecifier = node.specifiers.find(
specifier => specifier.type === specifierType
)

if (!defaultSpecifier) return
var imports = Exports.get(node.source.value, context)
Expand Down

0 comments on commit 0b1ced8

Please sign in to comment.