Skip to content
This repository was archived by the owner on Jan 25, 2022. It is now read-only.
This repository was archived by the owner on Jan 25, 2022. It is now read-only.

Argument order for callable replaceValue #16

@schuay

Description

@schuay

As a suggestion to improve ergonomics of @@replace calls with a callable replaceValue: passing namedCaptures to replaceValue as the second argument would allow a generic

function replacer(match, groups) {
  // Use captures from the groups object.
}

to handle RegExp's with varying capture counts.

This would be an improvement over the current state where one needs to either adapt the replacer signature for different capture counts, or use the arguments object.

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