lib.strings.{toSentenceCase,toCamelCase}: don't add context unnecessarily
builtins.substring doesn't destroy context - it's not necessary to add it back.
This commit is contained in:
+2
-2
@@ -1596,7 +1596,7 @@ rec {
|
||||
firstChar = substring 0 1 str;
|
||||
rest = substring 1 (-1) str; # -1 takes till the end of the string
|
||||
in
|
||||
addContextFrom str (toUpper firstChar + toLower rest)
|
||||
toUpper firstChar + toLower rest
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -1653,7 +1653,7 @@ rec {
|
||||
first = if length parts > 0 then toLower (head parts) else "";
|
||||
rest = if length parts > 1 then map toSentenceCase (tail parts) else [ ];
|
||||
in
|
||||
concatStrings (map (addContextFrom str) ([ first ] ++ rest))
|
||||
concatStrings ([ first ] ++ rest)
|
||||
);
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user