Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
dhaspden opened this issue Oct 19, 2019 · 0 comments
Labels
enhancement New feature or request
Milestone

Comments

@dhaspden
Copy link
Owner

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}
@dhaspden dhaspden added the enhancement New feature or request label Oct 19, 2019
@dhaspden dhaspden added this to the Version 1.0 milestone Oct 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant