Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for optMap() optional value macro #717

Merged
merged 2 commits into from
May 30, 2023

Conversation

TristonianJones
Copy link
Collaborator

The optional optMap() macro takes an optional value as input and performs a transformation on the value if it has a value.

The following expressions are equivalent:

value.optMap(v, v + 1)
value.hasValue() ? optional.of(value.value() + 1) : optional.none()

cel/library.go Outdated Show resolved Hide resolved
@TristonianJones
Copy link
Collaborator Author

PTAL

@TristonianJones TristonianJones merged commit afe0a6c into google:master May 30, 2023
@TristonianJones TristonianJones deleted the optional-macros branch May 30, 2023 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants