query
On this page

optionalString

lib.optionalString

Docs pulled from | This Revision | about 1 hour 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

optionalString usage example

optionalString true "some-string"
=> "some-string"
optionalString false "some-string"
=> ""
(lib.strings.optionalString)

Noogle also knows

Aliases