feat(fp): add function utilities (pipe, flow, identity, constant, flip, tupled, untupled) - #433
Open
martyy-code wants to merge 1 commit into
Open
feat(fp): add function utilities (pipe, flow, identity, constant, flip, tupled, untupled)#433martyy-code wants to merge 1 commit into
martyy-code wants to merge 1 commit into
Conversation
…p, tupled, untupled) These are the seven exports that the documentation has been promising since v1.0 (docs/internal/product/features/function-utilities.md) and that the README quotes as ergonomic essentials. The pipeables shipped in PR #431 (map, flatMap, ...) are now usable through pipe as the JSDoc in result/functions.ts and maybe/functions.ts already documents. `pipe` and `flow` carry variadic overloads up to nine steps. Beyond that the tail collapses to `unknown` and the caller is on their own. `tupled` and `untupled` are inverses. Tests assert both directions. Coverage stays at 100% across statements, branches, functions, and lines. Vitest thresholds remain pinned at 100% (set in PR #431). Co-Authored-By: Claude Fable 5 <[email protected]>
Contributor
Coverage report
Per-file thresholds: 100% on statements / branches / functions / lines (ADR 0002). Files with no branches render |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Delivers the seven function utilities that the documentation has been
promising since v1.0 (
docs/internal/product/features/function-utilities.md)and that the README quotes as ergonomic essentials:
pipe— left-to-right function composition with a starting value.flow— left-to-right function composition that returns a function.identity— the identity function.constant— wraps a value into a function that ignores its argument.flip— swaps the first two arguments of a binary function.tupled/untupled— tuple ↔ positional adapters.pipeandflowcarry variadic overloads up to nine steps. Beyondthat the tail collapses to
unknownand the caller is on their own.Why this PR
The README and the docs both reference
pipeas the canonical way tocompose the Result/Maybe pipeables. Before this PR, the JSDoc in
result/functions.tsandmaybe/functions.tsliterally wrotepipe(value, map(fn), flatMap(chain)), butpipedid not exist.A consumer copy-pasting the README example would get a TypeScript\nerror at import time. This PR closes the gap.
The pipeables shipped in PR #431 are now usable through
pipeas thedocumentation already advertises.
Public API
The seven exports are added to the public barrel under their bare
names. No collision with the existing pipeables (which are suffixed
with
Maybefor the Maybe namespace).Verification
pnpm --filter @deessejs/fp type-check— cleanpnpm --filter @deessejs/fp lint— cleanpnpm --filter @deessejs/fp test:run— 230 passed (was 202)pnpm --filter @deessejs/fp test:coverage— 100% statements /branches / functions / lines, thresholds pinned at 100%
Changeset
minor— new public exports.Plan
See
docs/engineering/plans/function-utilities.md.🤖 Generated with Claude Code