dotfiles/.dotter/helpers/var_with_default.rhai

12 lines
252 B
Text

// tests the type of variable passed in
// if 'no' type (does not exist or cant be parsed)
// we return the second, 'default' variable
fn choose(a, b) {
if type_of(a) != "()" {
return a;
}
return b;
}
choose(params[0], params[1])