Skip to content

Commit

Permalink
Merge pull request #2 from niveathika/case
Browse files Browse the repository at this point in the history
Disable restore case by default
  • Loading branch information
niveathika committed Jun 6, 2024
2 parents 1ce1002 + 23c6f13 commit 31d2f36
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 31d2f36

Please sign in to comment.