Skip to content

Document ? optionals#64

Merged
edemaine merged 1 commit intomainfrom
optional
Apr 6, 2026
Merged

Document ? optionals#64
edemaine merged 1 commit intomainfrom
optional

Conversation

@edemaine
Copy link
Copy Markdown
Collaborator

@edemaine edemaine commented Apr 6, 2026

Fixes #50

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 6, 2026

Greptile Summary

This PR adds a new documentation paragraph explaining the ? optional operator's behavior (returns value directly or undefined, no array wrapping) and updates the "Token location example" to use [$1, ...$2, $3].filter((token) => token !== undefined) instead of [].concat($1, $2, $3), correctly reflecting the direct-return (non-array) semantics of ?.

Confidence Score: 5/5

Safe to merge — documentation-only change with no code modifications.

All changes are accurate, internally consistent, and have no P0/P1 findings.

No files require special attention.

Important Files Changed

Filename Overview
README.md Adds accurate ? optional operator docs and updates code example to match the non-array return semantics

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["...? evaluated"] --> B{Does ... match?}
    B -- Yes --> C["Returns value directly\n(not wrapped in array)"]
    B -- No --> D["Succeeds without consuming input\nReturns undefined"]
Loading

Reviews (1): Last reviewed commit: "Document `?` optionals" | Re-trigger Greptile

@edemaine edemaine merged commit 20250c1 into main Apr 6, 2026
5 checks passed
@edemaine edemaine deleted the optional branch April 6, 2026 07:50
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.

Missing docs regarding ?

2 participants