Oneflow v0.2.0 Oneflow.Helpers
This module contains generic useful functions.
Link to this section Summary
Functions
Prepends given prefix to the given string
Removes any key value pair with a nil value in Enum. Given
the map %{test: nil, key: 1}
it should return a map
with jsut key
Link to this section Functions
Prepends given prefix to the given string.
Examples
iex> Oneflow.Helpers.prepend(“/accounts”, “/api”, :url) “/api/accounts”
iex> Oneflow.Helpers.prepend(“secret”, “token:”, :string) “token:secret”
Removes any key value pair with a nil value in Enum. Given
the map %{test: nil, key: 1}
it should return a map
with jsut key
.
Returns %{key: 1}
.
Examples
iex> item = %Oneflow.Models.Item{sourceItemId: “test”, sku: “sku”} iex> Oneflow.Helpers.remove_nil_values(item) %{sku: “sku”, sourceItemId: “test”}
iex> Oneflow.Helpers.remove_nil_values(%{test: nil, key: 1}) %{key: 1}
iex> Oneflow.Helpers.remove_nil_values([test: nil, key: 1]) [key: 1]