View Source Ext.Nil (ext v1.4.0)

Ext.Nil provides helper functions for values that can potentially be nil.

Summary

Functions

Transforms the given value using the mapper function if the value is not nil. Returns nil otherwise.

Functions

map(value, mapper)

Transforms the given value using the mapper function if the value is not nil. Returns nil otherwise.

Examples

iex> Ext.Nil.map(3, &(&1 + 5))
8

iex> Ext.Nil.map(nil, &(&1 + 5))
nil