Skip to content

Callable on map idiosyncratic #56

@dmeehan1968

Description

@dmeehan1968

map()s callable receives two arguments, the value and its index. This makes using standard library functions like trim and intval problematic without wrapping them in an anonymous or arrow function (because those functions have a second argument that alters behaviour).

It would be useful to have an alternative map() that does not supply the index. Without breaking the API this would need to be something like mapValue(), whereas it might have been preferable to have map() and mapWithIndex().

In part, the lack of documentation for each of Chain's methods, in regards to the Callable's parameters, doesn't help, without digging into the source.

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