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

Support it keyword in map function #21

Open
patelhumaira21 opened this issue Sep 16, 2021 · 1 comment
Open

Support it keyword in map function #21

patelhumaira21 opened this issue Sep 16, 2021 · 1 comment
Assignees
Labels
enhancement New feature or request hard

Comments

@patelhumaira21
Copy link

patelhumaira21 commented Sep 16, 2021

Is your feature request related to a problem? Please describe.
I have an array of objects like below

[ 
  {...},
  {...}
  ...
]

I want to map it to a new array like below

[
  { "someKey" : {...} },
  { "someKey" : {...} },
  ...
]

It is not possible to perform such a transformation using the map method.

Describe the solution you'd like

Below is an example of pickFIrst function usage.

pickFirst(a,b,c -> it != null)

It already has a concept of it reference, which is a self-reference to the current object while iterating over a,b and c.

We can apply this concept to the map function so that the above transformation can be achieved by

map(myArray -> {
  someKey = it
 })

Describe alternatives you've considered
None of the supported functions support this usecase

Additional context

@patelhumaira21 patelhumaira21 added the enhancement New feature or request label Sep 16, 2021
@shreyagajane
Copy link

I will be working on this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request hard
Projects
None yet
Development

No branches or pull requests

3 participants