optionalString
lib.strings.optionalString
Docs pulled from | This Revision | 17 minutes ago
Depending on the boolean `cond', return either the given string or the empty string. Useful to concatenate against a bigger string.
Inputs
cond
- Condition
string
- String to return if condition is true
Type
optionalString :: bool -> string -> string
Examples
lib.strings.optionalString
usage example
optionalString true "some-string"
=> "some-string"
optionalString false "some-string"
=> ""
Noogle detected
Implementation
The following is the current implementation of this function.
optionalString =
cond:
string: if cond then string else "";