Skip to content
This repository has been archived by the owner on Oct 7, 2024. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants