Skip to content

Commit

Permalink
Disable restore case by default
Browse files Browse the repository at this point in the history
  • Loading branch information
niveathika committed Jun 6, 2024
1 parent 1ce1002 commit 23c6f13
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions ballerina/configurables.bal
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

# This can be used to match case of the given word. Does not work with camel case
configurable boolean tryToRestoreCase = false;
4 changes: 4 additions & 0 deletions ballerina/main.bal
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ function replaceWordWithRules(string word, string token, [regexp:RegExp, Capture
}

function restoreCase(string word, string token) returns string {
if !tryToRestoreCase {
return token;
}

if word == token {
return token;
}
Expand Down
2 changes: 1 addition & 1 deletion ballerina/tests/tests.bal
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ import ballerina/test;
[string, string][] pluralDatasetExceptions = [
["box", "boxes"],
["Octopus", "Octopuses"],
["KNIFE", "KNIVES"],
["KNIfe", "KNIves"],
["loaf", "loaves"],
["index", "indices"],
["sheep", "sheep"],
Expand Down
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

### Changed
- Disable restore case functionality by default.

## [1.0.0] - 03/06/2024

Expand Down

0 comments on commit 23c6f13

Please sign in to comment.