View Source Moar.Term (Moar v0.1.0)

Extra functions for terms.

Link to this section Summary

Functions

Returns true if the term is blank, nil, or empty

Returns value unless it is blank, in which case it returns default

Returns the value if it is present (via present?), or else returns the default value

Returns true if the term is not blank, nil, or empty

Link to this section Functions

@spec blank?(any()) :: boolean()

Returns true if the term is blank, nil, or empty

Link to this function

or_default(value, default)

View Source
@spec or_default(any(), any()) :: any()

Returns value unless it is blank, in which case it returns default

Link to this function

presence(term, default \\ nil)

View Source
@spec presence(any(), any()) :: any()

Returns the value if it is present (via present?), or else returns the default value

@spec present?(any()) :: boolean()

Returns true if the term is not blank, nil, or empty