From 1dea7d1b7be7f7d0a9eb41b48b45810b56013f95 Mon Sep 17 00:00:00 2001 From: Morgan Hunt Date: Fri, 15 Oct 2021 14:47:58 -0500 Subject: [PATCH] refactor!: Change dot case format to enum.Value => enum.value --- CHANGELOG.md | 4 ++++ lib/src/cases/dot.dart | 2 +- lib/src/enums.dart | 2 +- pubspec.yaml | 2 +- test/src/cases/dot_test.dart | 2 +- test/src/change_case_test.dart | 6 +++--- 6 files changed, 11 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bc7b6b5..3ee357c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 1.0.1 + +- [BREAKING CHANGE]: change toDotCase() format to `enum.Value` to `enum.value` + # 1.0.0+3 - Update doc comments for each case to contain an example of the expected output diff --git a/lib/src/cases/dot.dart b/lib/src/cases/dot.dart index 413bdc0..6307864 100644 --- a/lib/src/cases/dot.dart +++ b/lib/src/cases/dot.dart @@ -6,5 +6,5 @@ class Dot extends ChangeCaseHelper { String get deliminator => '.'; @override - String transform(String section, int index) => section; + String transform(String section, int index) => section.toLowerCase(); } diff --git a/lib/src/enums.dart b/lib/src/enums.dart index 36a3f66..9a47dbf 100644 --- a/lib/src/enums.dart +++ b/lib/src/enums.dart @@ -26,7 +26,7 @@ enum ChangeCaseType { /// /// example: /// - /// `'hello World' -> 'hello.World'` + /// `'hello World' -> 'hello.world'` /// {@endtemplate} dot, diff --git a/pubspec.yaml b/pubspec.yaml index b858215..b9b136c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: change_case description: An extension on String to transform a string between camelCase, PascalCase, Capital Case, snake_case, param-case, CONSTANT_CASE and others. -version: 1.0.0+3 +version: 1.0.1 repository: https://github.com/mrgnhnt96/change_case homepage: https://github.com/mrgnhnt96/change_case diff --git a/test/src/cases/dot_test.dart b/test/src/cases/dot_test.dart index 0116705..edc3663 100644 --- a/test/src/cases/dot_test.dart +++ b/test/src/cases/dot_test.dart @@ -18,7 +18,7 @@ void main() { test('index 0 returns original', () { final result = dot.transform('Hello', 0); - expect(result, 'Hello'); + expect(result, 'hello'); }); test('index 1 returns original', () { diff --git a/test/src/change_case_test.dart b/test/src/change_case_test.dart index 7d5fd6f..5ca08e9 100644 --- a/test/src/change_case_test.dart +++ b/test/src/change_case_test.dart @@ -73,7 +73,7 @@ void main() { toCamelExpect: 'hello', toCapitalExpect: 'Hello', toConstantExpect: 'HELLO', - toDotExpect: 'HELLO', + toDotExpect: 'hello', toHeaderExpect: 'Hello', toKebabExpect: 'hello', toParamExpect: 'hello', @@ -95,7 +95,7 @@ void main() { toCamelExpect: 'hello', toCapitalExpect: 'Hello', toConstantExpect: 'HELLO', - toDotExpect: 'Hello', + toDotExpect: 'hello', toHeaderExpect: 'Hello', toKebabExpect: 'hello', toParamExpect: 'hello', @@ -117,7 +117,7 @@ void main() { toCamelExpect: 'hellO', toCapitalExpect: 'Hell O', toConstantExpect: 'HELL_O', - toDotExpect: 'hell.O', + toDotExpect: 'hell.o', toHeaderExpect: 'Hell-O', toKebabExpect: 'hell-o', toParamExpect: 'hell-o',