isEmpty and other ways to avoid toString() calls#137
Merged
mourner merged 1 commit intoRich-Harris:masterfrom Mar 19, 2018
Merged
isEmpty and other ways to avoid toString() calls#137mourner merged 1 commit intoRich-Harris:masterfrom
mourner merged 1 commit intoRich-Harris:masterfrom
Conversation
mourner
approved these changes
Mar 19, 2018
| isEmpty () { | ||
| if (this.intro.length && this.intro.trim()) | ||
| return false; | ||
| if (this.sources.some(source => !source.content.isEmpty())) |
Collaborator
There was a problem hiding this comment.
Should we avoid some in favor of simple for .. of loops? They also get transpiled into for loops by Buble here.
Contributor
Author
There was a problem hiding this comment.
Ahh, I didn't know Buble would handle the transpilation here.
Could do, although at this order of loop it probably isn't much of a difference.
Collaborator
|
Published in v0.24.0. |
Contributor
Author
|
Many thanks, it's a great help having this released for the incoming Rollup PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This supports
bundle.isEmpty()andsource.isEmpty()to avoid the need to do a fullbundle.toString().trim().length === 0check.Some other minor changes avoid unnecessary internal
toString()calls.