Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add multiExt option #81

Merged
merged 1 commit into from
Jun 11, 2018
Merged

Add multiExt option #81

merged 1 commit into from
Jun 11, 2018

Conversation

TheDancingCode
Copy link
Contributor

Allows parsing a path with multiple extensions.

Closes #16.

index.js Outdated
var dirname = Path.dirname(path);
var basename = Path.basename(path, extname);
if (options.multiExt) {
while (Path.extname(basename) !== '') {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you avoid using a while loop here, and check if there any node built-ins that handle this? I would be curious to see how other people implement this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No node built-ins unfortunately. path.extname doesn't handle multiple extensions, that's why I used it in a loop at first.

@TheDancingCode
Copy link
Contributor Author

@contra
Satisfied with the changes?

@yocontra yocontra merged commit 1ad76a5 into hparra:master Jun 11, 2018
@yocontra
Copy link
Collaborator

Published as 1.3.0 - thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants