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

Fix at fn #809

Merged
merged 9 commits into from
Jan 16, 2024
Merged

Fix at fn #809

merged 9 commits into from
Jan 16, 2024

Conversation

goastler
Copy link
Member

fixes #808

Copy link

Pull Request Report

Hey there! 👋 Here's a summary of the changes made in this pull request:

Changes

  1. Fixed the undefined return type for array usage of at() function. (util.ts:61)
  2. Made the optional call of at() function use AtOptions instead of duplicating options again. (util.ts:61)
  3. Removed debug statements.

Suggestions

  1. It would be great to add some comments explaining the purpose of the AtOptions interface. (util.ts:61)

Bugs

No bugs found. Yay! 🐛

Improvements

  1. The at() function could be refactored for better readability. Here's an improved version:
export function at<T>(arr: T[] | string, i: number, options?: { optional: true } & AtOptions): T | undefined {
    if (!options?.noWrap) {
        // Add logic here
    }
}

Rating

I would rate the code as follows:

  • Readability: 8/10
  • Performance: 9/10
  • Security: 10/10

Great job overall! 🎉

@goastler goastler enabled auto-merge (squash) January 16, 2024 21:26
@goastler goastler merged commit af0df5d into main Jan 16, 2024
6 checks passed
@goastler goastler deleted the fix-at-fn branch January 16, 2024 21:45
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.

fix at() fn unable to get optional elements
2 participants