Return undefined only when arr[index] is undefined - #56
Conversation
3b473dc to
dd76f9e
Compare
There was a problem hiding this comment.
Pull request overview
This PR attempts to fix a bug from issue #55 by adding an undefined check in the getLastElementOf function when withIndex: true. However, the implementation introduces a new bug by incorrectly treating arrays that legitimately contain undefined as their last element.
Key changes:
- Added conditional logic to return
undefinedwhenarr[index] === undefinedin thewithIndex: truepath - Bumped package version from 2.0.0 to 2.0.1
- Updated pnpm packageManager version and added
import/orderto ESLint rules
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/universal/get-last-element-of.ts | Adds undefined check that incorrectly returns undefined for arrays with undefined as last element, creating inconsistent behavior between withIndex true/false paths |
| package.json | Updates version to 2.0.1 and pnpm packageManager to 10.24.0 |
| .vscode/settings.json | Adds import/order to ESLint codeActionsOnSave rules |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
dd76f9e to
ad14548
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
4024b00 to
56353c3
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
56353c3 to
d911b71
Compare
Fix a bug caused by #55.