lib.strings.trimWith: Refactor scoping (#339001)
This commit is contained in:
commit
cb6c5083a3
@ -408,7 +408,6 @@ rec {
|
|||||||
start ? false,
|
start ? false,
|
||||||
end ? false,
|
end ? false,
|
||||||
}:
|
}:
|
||||||
s:
|
|
||||||
let
|
let
|
||||||
# Define our own whitespace character class instead of using
|
# Define our own whitespace character class instead of using
|
||||||
# `[:space:]`, which is not well-defined.
|
# `[:space:]`, which is not well-defined.
|
||||||
@ -425,12 +424,14 @@ rec {
|
|||||||
"(.*[^${chars}])[${chars}]*"
|
"(.*[^${chars}])[${chars}]*"
|
||||||
else
|
else
|
||||||
"(.*)";
|
"(.*)";
|
||||||
|
in
|
||||||
|
s:
|
||||||
|
let
|
||||||
# If the string was empty or entirely whitespace,
|
# If the string was empty or entirely whitespace,
|
||||||
# then the regex may not match and `res` will be `null`.
|
# then the regex may not match and `res` will be `null`.
|
||||||
res = match regex s;
|
res = match regex s;
|
||||||
in
|
in
|
||||||
optionalString (res != null) (head res);
|
optionalString (res != null) (head res);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Construct a Unix-style, colon-separated search path consisting of
|
Construct a Unix-style, colon-separated search path consisting of
|
||||||
|
Loading…
Reference in New Issue
Block a user