lib/trivial: add boolToYesNo

This commit is contained in:
Felix Buehler
2025-06-01 22:57:22 +02:00
parent e7f33001ef
commit c1ad4464c6
2 changed files with 21 additions and 0 deletions

View File

@@ -127,6 +127,7 @@ let
bitXor bitXor
bitNot bitNot
boolToString boolToString
boolToYesNo
mergeAttrs mergeAttrs
flip flip
defaultTo defaultTo

View File

@@ -240,6 +240,26 @@ in
*/ */
boolToString = b: if b then "true" else "false"; boolToString = b: if b then "true" else "false";
/**
Converts a boolean to a string.
This function uses the strings "yes" and "no" to represent
boolean values.
# Inputs
`b`
: The boolean to convert
# Type
```
boolToYesNo :: bool -> string
```
*/
boolToYesNo = b: if b then "yes" else "no";
/** /**
Merge two attribute sets shallowly, right side trumps left Merge two attribute sets shallowly, right side trumps left