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

How to generate using FN #116

Open
max-prtsr opened this issue Apr 3, 2023 · 1 comment
Open

How to generate using FN #116

max-prtsr opened this issue Apr 3, 2023 · 1 comment

Comments

@max-prtsr
Copy link

I got how to generate subarrays

MAP(FN(fr, {fr.name, fr.color}), fruits[*])
// [["apple", "red"], ["banana", "yellow"], ["orange", "orange"], ["grape", "purple"], ["pear", "green"]]

But I need

[{label: red, value: 'apple'}, {label: yellow, value: 'banana'}]
@DeLaGuardo
Copy link
Contributor

MAP(FN(fr, OBJECT.NEW({{'label', fr.color}, {'value', fr.name}})), fruits[*])

You can use OBJECT.NEW function to create an object. This function accepts an array of pairs: { {key, value}, ... }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants