Skip to content

Commit

Permalink
refactor: avoid Array.from the same thing twice
Browse files Browse the repository at this point in the history
  • Loading branch information
golopot committed Jul 17, 2019
1 parent 2443ba3 commit e48eb0e
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/rules/export.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,8 @@ const tsTypePrefix = 'type:'
* @returns {boolean}
*/
function isTypescriptFunctionOverloads(nodes) {
return Array.from(nodes).some(node => node.parent.type === 'TSDeclareFunction') &&
Array.from(nodes).every(node => (
node.parent.type === 'TSDeclareFunction' ||
node.parent.type === 'FunctionDeclaration'
))
const types = new Set(Array.from(nodes, node => node.parent.type))
return types.size === 2 && types.has('TSDeclareFunction') && types.has('FunctionDeclaration')
}

module.exports = {
Expand Down

0 comments on commit e48eb0e

Please sign in to comment.