Skip to content

[Feature Request] Record map #469

Closed
Closed
@thebestnom

Description

@thebestnom

hi, I would like to add a suggestion that Record will have a map function, it's already have forEach so I think its not too difference.
my use case is doing async stuff inside the forEach and I want to await there

const promises = recored.map(async (v) => {
   // ... stuff
   await stuff(v)
   //... more stuff
})
await Promise.all(promises)

which I cant do with forEach,
what I did instead for now is

const promises = Object.values(record.toObject()).map(async (v) => {
   // ... stuff
   await stuff(v)
   //... more stuff
})
await Promise.all(promises)

which is kinda hack

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions