Skip to content

Key mapping should also support the ability to map the value on that field #2

@dhaspden

Description

@dhaspden

Features:

I think it would be awesome to support a third element in the tuple which is a transformer function. This function will transform the value (if it's set of course) to whatever the return value of the callback function is.

Example:

iex> key_mapping = [{"a", ":a", &Integer.parse/1}]
iex> data = %{"a" => "123"}
iex> {:ok, formatted_data} = Transmog.format(data, key_mapping)
iex> formatted_data
%{a: 123}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions