Skip to content

Reduce with governor, without initial value #5

@kriskowal

Description

@kriskowal

Array.prototype.reduce is sensitive to call arity, to detect whether to begin with a base value or wait for the first iteration result. So, the governor argument forces the arity high enough to compel the interpretation of an undefined base result.

  • Should AsyncIterator.prototype.reduce be insensitive to arity, defaulting the basis to undefined? In this world, governor can be a third positional argument without issue.
  • Should AsyncIterator.prototype.reduce be sensitive to arrity, always interpreting the presence of a governor as consent to treat the second argument as a basis.
  • Should AsyncIterator.prototype have a separate method; e.g., reduceWithGovernor, governedReduce, or produce; that accepts a governor and optional basis?

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