Skip to content
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

style(pass-style): Reduce nesting depth for input validation #2097

Merged
merged 1 commit into from
Feb 22, 2024

Conversation

gibson042
Copy link
Contributor

Description

Reduce the nesting depth for input validation by defining rejects as tag functions rather than traditional wrappers.

Security Considerations

n/a

Scaling Considerations

Constructing details is already in the slow path exercised only with an explicit check function, and introducing rest/spread to the wrapper imposes minor additional cost (the reject call itself gets about 6% slower on XS and 20% slower on V8). We could probably do better by passing reject functions rather than constructing them at each level, but that would affect the public API so I'm not contemplating that here.

Documentation Considerations

n/a

Testing Considerations

n/a

Compatibility Considerations

n/a

Upgrade Considerations

n/a

  • Includes *BREAKING*: in the commit message with migration instructions for any breaking change.
  • Updates NEWS.md for user-facing changes.

Copy link
Member

@kriskowal kriskowal left a comment

Choose a reason for hiding this comment

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

Looks mechanical to me.

@gibson042 gibson042 force-pushed the gibson-2024-02-pass-style-validation-nesting branch from 2b160e5 to b56e40f Compare February 22, 2024 15:43
@gibson042 gibson042 enabled auto-merge February 22, 2024 15:44
@gibson042 gibson042 force-pushed the gibson-2024-02-pass-style-validation-nesting branch from b56e40f to b8faeea Compare February 22, 2024 15:45
@gibson042 gibson042 merged commit 2753ac2 into master Feb 22, 2024
14 checks passed
@gibson042 gibson042 deleted the gibson-2024-02-pass-style-validation-nesting branch February 22, 2024 15:52
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