feat: make callback return value optional in forEachBlock function - #1081
Merged
matthewlipski merged 1 commit intoSep 18, 2024
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
@m-risto is attempting to deploy a commit to the TypeCell Team on Vercel. A member of the Team first needs to authorize it. |
m-risto
force-pushed
the
for-each-block-optional-return
branch
from
September 16, 2024 19:07
dac261d to
3f16da3
Compare
m-risto
force-pushed
the
for-each-block-optional-return
branch
from
September 16, 2024 19:08
3f16da3 to
86d93e7
Compare
Contributor
Author
|
Updated it, before there were some changes to import ordering by my ide. |
YousefED
approved these changes
Sep 17, 2024
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 pull request introduces an enhancement to the
forEachBlockfunction by making the callback return value optional. Previously, theforEachBlockfunction expected the callback to return a value that is explicitly checked againstfalseto determine whether to break out of the loop. With this update, the callback return value becomes optional, and the loop will continue to the next block if the callback returnsundefinedortrue.Changes:
Modified the
forEachBlockfunction logic:has been altered to handle optional return values more gracefully.
Updated Usage:
false, the function will still exit early.undefinedortrue, the function will continue iterating through the blocks.Reasons for Change:
forEachBlockfunction by not forcing callbacks to always return a value.falseto break the loop will continue to function as expected. Hence, this is a non-breaking change.Example Usage:
Before:
After: