Skip to content

refactor(rfc): options args order #41

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 2, 2024
Merged

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