Skip to content

Commit d08f3a6

Browse files
committed
fix: remove unnecessary null assertions and bump version to 1.2.0
- Remove unnecessary `!` operators after fixing nullable return types - Fix style warning: put control body on separate line in prune() - Update version to 1.2.0 for pub.dev release 🤖 Generated with [Claude Code](https://claude.com/claude-code)
1 parent b49bcde commit d08f3a6

3 files changed

Lines changed: 9 additions & 7 deletions

File tree

lib/src/case/case.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ extension Case on String {
1313
.mapIndex(
1414
(word, index) => index == 0
1515
? preserveAcronym
16-
? (word!.isUpperCase() ? word : word.toLowerCase())
17-
: word!.toLowerCase()
18-
: word!.capitalize(),
16+
? (word.isUpperCase() ? word : word.toLowerCase())
17+
: word.toLowerCase()
18+
: word.capitalize(),
1919
)
2020
.toList()
2121
.join();
@@ -40,7 +40,7 @@ extension Case on String {
4040

4141
/// Converts a string to kebab-case
4242
String kebabCase() =>
43-
words().mapIndex((word, index) => word!.toLowerCase()).join("-");
43+
words().mapIndex((word, index) => word.toLowerCase()).join("-");
4444

4545
/// Converts the whole string to lowercase
4646
@Deprecated('Use .toLowerCase() instead')
@@ -52,7 +52,7 @@ extension Case on String {
5252

5353
/// Converts string to snake_case
5454
String snakeCase() =>
55-
words().mapIndex((word, index) => word!.toLowerCase()).join("_");
55+
words().mapIndex((word, index) => word.toLowerCase()).join("_");
5656

5757
/// Converts uppercase characters of a string to lowercase and vice versa
5858
String swapCase() {

lib/src/chop/chop.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ extension Chop on String {
4040
/// than or equal to the [pruneLength] provided. Handles spaces, tabs, and
4141
/// other whitespace characters.
4242
String prune(int pruneLength) {
43-
if (length <= pruneLength) return this;
43+
if (length <= pruneLength) {
44+
return this;
45+
}
4446

4547
final result = substring(0, pruneLength);
4648
// Check if we're in the middle of a word

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: stringr
22
description: Comprehensive string manipulation plugin for dart. Handles operations on latin, non latin and grapheme clusters alike! Features inspured from VocaJs
3-
version: 1.1.0
3+
version: 1.2.0
44
homepage: https://github.com/Chinmay-KB/stringr
55

66
environment:

0 commit comments

Comments
 (0)