mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-12 20:55:31 +03:00
lib.strings: Rename isCoercibleToString -> isMoreCoercibleToString
This commit is contained in:
parent
3a4c9bdbe6
commit
68b6443ed6
1 changed files with 11 additions and 2 deletions
|
@ -798,8 +798,17 @@ rec {
|
||||||
in lib.warnIf (!precise) "Imprecise conversion from float to string ${result}"
|
in lib.warnIf (!precise) "Imprecise conversion from float to string ${result}"
|
||||||
result;
|
result;
|
||||||
|
|
||||||
/* Check whether a value can be coerced to a string */
|
/* Soft-deprecated name for isMoreCoercibleToString */
|
||||||
isCoercibleToString = x:
|
isCoercibleToString = lib.warnIf (lib.isInOldestRelease 2305)
|
||||||
|
"lib.strings.isCoercibleToString is deprecated in favor of either isSimpleCoercibleToString or isMoreCoercibleString. Only use the latter if it needs to return true for null, numbers, booleans and list of similarly coercibles."
|
||||||
|
isMoreCoercibleToString;
|
||||||
|
|
||||||
|
/* Check whether a list or other value can be passed to toString.
|
||||||
|
|
||||||
|
Many types of value are coercible to string this way, including int, float,
|
||||||
|
null, bool, list of similarly coercible values.
|
||||||
|
*/
|
||||||
|
isMoreCoercibleToString = x:
|
||||||
elem (typeOf x) [ "path" "string" "null" "int" "float" "bool" ] ||
|
elem (typeOf x) [ "path" "string" "null" "int" "float" "bool" ] ||
|
||||||
(isList x && lib.all isCoercibleToString x) ||
|
(isList x && lib.all isCoercibleToString x) ||
|
||||||
x ? outPath ||
|
x ? outPath ||
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue