Skip to content

Commit

Permalink
No replacement if target string is empty. #23
Browse files Browse the repository at this point in the history
  • Loading branch information
sun-jiao committed Jul 20, 2024
1 parent c96def3 commit 0d464b7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/rules/rule_replace.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ class RuleReplace implements Rule {

@override
Future<String> newName(String oldName, {FileMetadata? metadata}) async {
if (targetString.isEmpty) {
return oldName;
}

if (withMetadata && metadata == null) {
throw ArgumentError(L10n.current.metadataParserNotProvided);
}
Expand Down

0 comments on commit 0d464b7

Please sign in to comment.