Current section

Files

Jump to
sprocket src docs utils common.gleam
Raw

src/docs/utils/common.gleam

import gleam/option.{None, Option, Some}
/// Maybe return Some element if the condition is true
/// otherwise return None
pub fn maybe(condition: Bool, element: a) -> Option(a) {
case condition {
True -> Some(element)
False -> None
}
}