Skip to content

Replace awkward last-element selection pattern with 'lastOrUndefined'#2996

Merged
DanielRosenwasser merged 3 commits into
masterfrom
lastOrUndefinedReplacement
May 4, 2015
Merged

Replace awkward last-element selection pattern with 'lastOrUndefined'#2996
DanielRosenwasser merged 3 commits into
masterfrom
lastOrUndefinedReplacement

Conversation

@DanielRosenwasser
Copy link
Copy Markdown
Member

No description provided.

Comment thread src/compiler/emitter.js
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lastOrUndefined is for calling on arrays that might be empty. You should never actually get undefined back in these cases, and we'd want to throw if you did. We should just have an 'last' functoin that only works on non-empty arrays, and throws otherwise.

@CyrusNajmabadi
Copy link
Copy Markdown
Contributor

👍

@DanielRosenwasser DanielRosenwasser force-pushed the lastOrUndefinedReplacement branch from a9c46e7 to 9460fb5 Compare May 2, 2015 01:36
DanielRosenwasser added a commit that referenced this pull request May 4, 2015
Replace awkward last-element selection pattern with 'lastOrUndefined'
@DanielRosenwasser DanielRosenwasser merged commit 4cc1848 into master May 4, 2015
@CyrusNajmabadi CyrusNajmabadi deleted the lastOrUndefinedReplacement branch June 4, 2015 00:26
@microsoft microsoft locked and limited conversation to collaborators Jun 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants