Skip to content

Added filterUndefined params to array rule#354

Open
vrag86 wants to merge 4 commits into
icebob:masterfrom
vrag86:master
Open

Added filterUndefined params to array rule#354
vrag86 wants to merge 4 commits into
icebob:masterfrom
vrag86:master

Conversation

@vrag86

@vrag86 vrag86 commented Oct 29, 2025

Copy link
Copy Markdown

I add filterUndefined params to array rule. It need when create custom items validator and skip not validated items

@icebob-ai icebob-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR, @vrag86!

The idea of filtering values from arrays is useful, but there are a few issues to address:

Missing pieces

  • No tests — need at least: filterUndefined removes undefined, doesn't remove null/falsy, works with items validation, disabled by default
  • No TypeScript type updatesRuleArray in index.d.ts needs a filterUndefined?: boolean property
  • No README documentation for the new option

Design concern

A more universal approach would be better here. Instead of only filtering undefined, consider a more general option like filter that could handle multiple cases:

  • Filter undefined values
  • Filter null values
  • Filter both null and undefined (nullish)
  • Or even a custom filter function

Something like filter: "undefined" | "null" | "nullish" or filter: (value) => boolean would be more flexible and cover more use cases.

Please consider reworking this with a broader design, adding tests, TypeScript types, and documentation.

@vrag86

vrag86 commented Jul 8, 2026

Copy link
Copy Markdown
Author

I fix all

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