Skip to content

Conversation

mdjastrzebski
Copy link
Member

@mdjastrzebski mdjastrzebski commented Jan 1, 2024

Summary

Modify existing function signatures (buildRegex, repeat) to move options argument to last position. My goal here is to have consistency with optional options, which typically are passed as last argument in JS.

In the near future that should also include capture([...], { name: '...' }) variant, where name would be optional.

Test plan

Update all tests and docs.

@mdjastrzebski mdjastrzebski force-pushed the refactor/options-args-order branch from 78aa3d3 to 53fb00a Compare January 2, 2024 08:36
);

const regex = buildRegex([
startOfString, //
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused comment?

Suggested change
startOfString, //
startOfString,

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, inserting comment this way prevents prettier from collapsing complex expression into single line. Multiline expressions are imo more readable.

@mdjastrzebski mdjastrzebski merged commit c8a3f36 into main Jan 2, 2024
@mdjastrzebski mdjastrzebski deleted the refactor/options-args-order branch January 2, 2024 21:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants