Skip to content

adding firstMap() #89

Open
Open
@chrisguttandin

Description

@chrisguttandin

Hi Nicholas,

what do you think about adding a firstMap() operator? I often use a pattern like this in my code:

someObservable$
    .pipe(
        first(),
        mergeMap(() => {
            // ...
        })
    )

But sometimes I end up using switchMap() or concatMap() instead of mergeMap(). I think it doesn't matter which xxxMap() operator gets used after the first() operator and it always makes me wonder if it would be easier to reason about the code if there was an operator which just hides that.

someObservable$
    .pipe(
        firstMap(() => {
            // ...
        })
    )

If you think it's a useful addition, I would be happy to provide a PR for it.

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