Skip to content

Conversation

@richecr
Copy link
Owner

@richecr richecr commented Nov 30, 2025

This pull request introduces a new filter method to the Maybe type, enabling value filtering based on predicates for both object-oriented and functional/curried usage. The change is thoroughly documented and tested, and includes updates to configuration and scripts for improved test coverage requirements.

Maybe type enhancements

  • Added a filter(fn: (value: T) => boolean): Maybe<T> method to the Maybe interface, with implementations for both Just and Nothing. This allows filtering values in a Maybe, returning Nothing if the predicate fails. [1] [2] [3]
  • Introduced a curried filter helper for functional pipelines, enabling easy composition with other Maybe helpers.

Documentation improvements

  • Expanded the documentation in docs/maybe/index.md to explain and provide examples for the new filter method and its curried usage. Includes common use cases like validation and parsing. [1] [2]

Testing

  • Added comprehensive tests for the new filter functionality, covering direct usage, chaining, curried pipelines, and various scenarios. [1] [2]

Configuration and scripts

  • Updated bunfig.toml to require 100% coverage for lines, functions, statements, and branches, and to skip test files from coverage calculations.
  • Adjusted the test script in package.json to run tests without the coverage flag, since coverage is now controlled via config.

@richecr richecr merged commit a14796b into main Nov 30, 2025
1 check passed
@richecr richecr deleted the feat/added_filter_in_maybe branch December 2, 2025 14:52
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