Skip to content

patternMatcher: Use helper functions to simplify loops over strings#23095

Merged
2 commits merged intomasterfrom
every
Apr 4, 2018
Merged

patternMatcher: Use helper functions to simplify loops over strings#23095
2 commits merged intomasterfrom
every

Conversation

@ghost
Copy link
Copy Markdown

@ghost ghost commented Apr 2, 2018

This file contains many loops over a string checking that every character matches some predicate.

}

return true;
return every(identifier, ch => charIsPunctuation(ch) && ch !== CharacterCodes._, start, end);
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

(charIsPunctuation doesn't have a case for $ anyway)

Comment thread src/services/patternMatcher.ts Outdated
// Note: if the segment contains a space or an asterisk then we must assume that it's a
// multi-word segment.
if (!containsSpaceOrAsterisk(segment.totalTextChunk.text)) {
if (!every(segment.totalTextChunk.text, ch => ch !== CharacterCodes.space && ch !== CharacterCodes.asterisk)) {
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.

is the ! still needed?

@ghost ghost merged commit 5b928a3 into master Apr 4, 2018
@ghost ghost deleted the every branch April 4, 2018 15:37
@microsoft microsoft locked and limited conversation to collaborators Jul 25, 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.

1 participant