Summary
Change lib/bash/str/lib_str.sh so string transformation helpers mutate named variables in place instead of printing transformed values for command substitution.
Motivation
The current str_lower, str_upper, and trim helpers encourage command substitution such as value=$(str_trim "$value"), which creates a subshell. Since these helpers are shell-library functions, the preferred API should avoid subshells and use validated variable names with printf -v.
Scope
- Add a public stdlib assertion for valid Bash variable names.
- Change string transformation helpers to accept variable names and mutate values in place.
- Keep predicate helpers value-based because they do not transform data.
- Keep split/join/member helpers result-variable or predicate style, but use the public stdlib assertion instead of the private validator.
- Update README and BATS coverage.
Validation
- Focused BATS for stdlib and string helpers.
./tests/validate.sh.
git diff --check.
Summary
Change
lib/bash/str/lib_str.shso string transformation helpers mutate named variables in place instead of printing transformed values for command substitution.Motivation
The current
str_lower,str_upper, and trim helpers encourage command substitution such asvalue=$(str_trim "$value"), which creates a subshell. Since these helpers are shell-library functions, the preferred API should avoid subshells and use validated variable names withprintf -v.Scope
Validation
./tests/validate.sh.git diff --check.