-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
Simplify incrementFileName #75398
Simplify incrementFileName #75398
Conversation
}); | ||
// name copy 5(.txt) => name copy 6(.txt) | ||
// name copy(.txt) => name copy 2(.txt) | ||
let suffixRegex = /^(.+ copy)( \d+)?$/; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We prefer to use const
over let
when possible
}); | ||
let namePrefix = name; | ||
let extSuffix = ''; | ||
if (!isFolder) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it help to use the paths.extname helper to simplify things here?
This is some great work. I love it, especailly the tests! If you want you can address my two minor comments. I would merge this either way. Thanks a lot! |
@isidorn updated the PR, now I'm using |
Great work, merging in. |
Fixes #55128