Skip to content

feat: new util zipDataResult#22

Merged
fratzinger merged 1 commit intomainfrom
feat/zip-data-result
Feb 27, 2026
Merged

feat: new util zipDataResult#22
fratzinger merged 1 commit intomainfrom
feat/zip-data-result

Conversation

@fratzinger
Copy link
Member

This pull request introduces a new utility function, zipDataResult, to the codebase, along with comprehensive type and behavior tests, documentation, and index exports. The main goal is to provide a standardized way to pair up data and result items in Feathers hooks, supporting both single objects and arrays, and handling edge cases such as mismatched array lengths.

The most important changes are:

New Utility Functionality:

  • Added the zipDataResult utility in zip-data-result.util.ts, which pairs context.data and context.result items by index for after and around hooks on create, update, and patch methods. The function supports both array and single-object inputs, and includes an onMismatch option for handling array length mismatches.

Testing:

  • Added extensive tests in zip-data-result.util.test.ts to verify types, correct pairing logic, edge cases (such as empty arrays and mismatched lengths), and the behavior of the onMismatch option.

Documentation:

  • Added a documentation markdown file, zip-data-result.util.md, to describe the purpose and usage of zipDataResult.

Exports and Integration:

  • Exported zipDataResult from the main utilities index (src/utils/index.ts) so it is available for use throughout the codebase.
  • Included zipDataResult in the test utility list in test/index.test.ts to ensure it is covered by global utility tests.

@cloudflare-workers-and-pages
Copy link

Deploying feathers-utils with  Cloudflare Pages  Cloudflare Pages

Latest commit: 6ee151e
Status: ✅  Deploy successful!
Preview URL: https://09a248d6.feathers-utils.pages.dev
Branch Preview URL: https://feat-zip-data-result.feathers-utils.pages.dev

View logs

@fratzinger fratzinger merged commit 4317aa2 into main Feb 27, 2026
11 checks passed
@fratzinger fratzinger deleted the feat/zip-data-result branch February 27, 2026 09:12
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.

1 participant