Skip to content

Conversation

@vrugtehagel
Copy link
Contributor

@vrugtehagel vrugtehagel commented Dec 19, 2025

I considered isEmpty (and is_empty) as well, but I went with the simpler empty because its use is mostly limited to {{ if }} statements. It's unlikely users are directly printing booleans, and the filter is more-or-less useless in tags like {{ echo }} or {{ for }}. Given the relatively narrow scope, I don't think there are readability issues with omitting the is from the name. Generally it'll be used in contexts where booleans are expected, like

{{ if items |> empty }}
  {{ set isMissingTags = tags |> empty }}
{{ /if }}

Resolves #153

I considered `isEmpty` (and `is_empty`) as well, but I went with the
simpler `empty` because its use is mostly limited to `{{ if }}`
statements. It's unlikely users are directly printing booleans, and the
filter is more-or-less useless in tags like `{{ echo }}` or `{{ for }}`.
Given the relatively narrow scope, I don't think there are readability
issues with omitting the `is` from the name. Generally it'll be used in
contexts where booleans are expected, like

```vto
{{ if items |> empty }}
  {{ set isMissingTags = tags |> empty }}
{{ /if }}
```
@oscarotero oscarotero merged commit 3a15f47 into main Dec 19, 2025
1 check passed
@oscarotero oscarotero deleted the add-empty-filter branch December 19, 2025 11:15
@oscarotero
Copy link
Member

It's great. Thank you!

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.

Detect empty arrays?

3 participants