Skip to content

Refactor which() (too many repeated code blocks) #656

@nfischer

Description

@nfischer

Self-assigning. I'll take this up when I have time. This is a pure refactor to reduce repeated code blocks.

I noticed we have 3 blocks of code where we push the match (where.push(attempt)...where = attempt): 2 inside of the win section, 1 in the unix section. We can easily combine these.

  1. Make the path-ext array, but initialize it to [] for unix and to [''].concat(splitPath()) for Windows
  2. Always iterate over the path-ext array. The only member is the empty string on unix, so nothing should change.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions