ExUtils v0.1.1 ExUtils

Collection of core Elixir utility methods that don’t fit in any specific Module

Summary

Functions

Checks if the term is a pure map (i.e. not a struct)

Checks if the term is a struct as well as a map

Functions

is_pure_map?(term)

Checks if the term is a pure map (i.e. not a struct)

Example

ExUtils.is_pure_map?(%{a: 1, b: 2})          # => true
ExUtils.is_pure_map?(%Person{name: "Ali"})   # => false
is_struct?(term)

Checks if the term is a struct as well as a map

Example

ExUnit.is_struct?(:atom)                  # => false
ExUnit.is_struct?(%{a: 1})                # => false
ExUnit.is_struct?(%Person{name: "Ali"})   # => true