Skip to content

Multi-level array values into a single array #88

Description

@tony-oldport

Apologies if there's an obvious answer to this. I think I've tried to do it every possible way except for the correct way.

If I have the following source object:

payload: {
    plans: [
        {
            planId: 1, 
            services: [
                { svcId: 100 },
                { svcId: 200 }
            ]
        },
        {
            planId: 2, 
            services: [
                { svcId: 300 }
            ]
        }
    ]
}

How can I map this to return an array of the service IDs? [100, 200, 300]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions