Skip to content

Add helper functions for adding an item to an array only if it's not already contained#17833

Merged
2 commits merged into
masterfrom
addUnique
Aug 24, 2017
Merged

Add helper functions for adding an item to an array only if it's not already contained#17833
2 commits merged into
masterfrom
addUnique

Conversation

@ghost
Copy link
Copy Markdown

@ghost ghost commented Aug 16, 2017

This seems to be a fairly common pattern.

Copy link
Copy Markdown
Member

@sandersn sandersn left a comment

Choose a reason for hiding this comment

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

Looks good although I think you missed one appendIfUnique conversion.

Comment thread src/compiler/checker.ts Outdated
@@ -6060,8 +6043,8 @@ namespace ts {
if (!props) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

isn't this props = appendIfUnique(props, prop) ?

@ghost ghost merged commit 2fede09 into master Aug 24, 2017
@ghost ghost deleted the addUnique branch August 24, 2017 15:03
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
This pull request was closed.
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.

2 participants