Skip to content

every([]) Returns true (Vacuous Truth) #93

@Hrdtr

Description

@Hrdtr

Describe the feature

// v1.x: every([]) → false
// v2.0: every([]) → true (matches Array.prototype.every semantics)

Rationale

JavaScript's [].every(fn) returns true. The v1.x behavior was non-standard and
asymmetric with none([])true.

Migration

Use $expr with length check if you need to deny empty arrays:

{ items: { length: ['gt', 0], $expr: ['every', { status: ['eq', 'active'] }] } }

Implementation Tasks

  • Remove (value as any[]).length === 0 early return in every handler
  • Update tests
  • Document in migration guide

Additional information

  • Would you be willing to help implement this feature?
  • Can you think of other implementations of this feature?

Final checks

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions