Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Promises
  3. p-tap

p-tap

MITJavaScriptv4.0.0

A utility to tap into promise chains for side effects without affecting the promise value or state.

GitHubGitHub
134 stars7 forks0 contributors

What is p-tap?

p-tap is a JavaScript utility library that enables developers to tap into promise chains to perform side effects—like logging, debugging, or asynchronous operations—without affecting the promise's resolved value or state. It solves the problem of wanting to observe or execute code during promise execution without breaking the chain's flow.

Target Audience

JavaScript developers working with promise chains who need to inject side effects for debugging, logging, or asynchronous operations without modifying promise values.

Value Proposition

Developers choose p-tap because it provides a clean, focused solution for promise side effects that integrates seamlessly with existing promise chains, unlike manual approaches that can clutter code or alter promise behavior.

Overview

Tap into a promise chain without affecting its value or state

Use Cases

Best For

  • Logging promise values during debugging without affecting chain results
  • Recording analytics or stats asynchronously within promise flows
  • Injecting side effects in functional promise compositions
  • Error logging in promise chains without interfering with error handling
  • Debugging complex promise chains with minimal code changes
  • Performing asynchronous operations alongside main promise logic

Not Ideal For

  • Projects exclusively using async/await without promise chains
  • Teams needing side effects to modify promise values (p-tap intentionally preserves them)
  • Applications with promise libraries that have built-in tap methods, like Bluebird

Pros & Cons

Pros

Non-invasive Side Effects

Allows executing code like logging or async operations without altering the promise's resolved value, as shown in README examples where 'value' remains unchanged after pTap.

Built-in Error Tapping

Includes pTap.catch() for tapping into promise rejections, enabling error logging without interfering with the chain's error handling, demonstrated in the catch example.

Async Handler Support

Automatically awaits promise-returning tap handlers before continuing the chain, ensuring side effects complete, as mentioned in the API section.

Minimal and Focused

Follows the Unix philosophy of doing one thing well, providing a lightweight utility without unnecessary complexity, as stated in the project philosophy.

Cons

Limited to Promise Chains

Not directly compatible with async/await syntax, requiring wrapping or conversion that can add boilerplate code for modern JavaScript projects.

Dependency Overhead for Simple Cases

For basic logging or side effects, using native .then() might suffice, and adding p-tap could introduce an unnecessary dependency in small projects.

Potential Thunk Confusion

The thunk-based API might confuse developers unfamiliar with functional programming concepts, leading to incorrect usage or debugging challenges.

Frequently Asked Questions

Quick Stats

Stars134
Forks7
Contributors0
Open Issues0
Last commit5 years ago
CreatedSince 2016

Tags

#debugging-tools#functional-programming#async-programming#side-effects#promise-utilities#es6-promises#nodejs#javascript

Built With

J
JavaScript

Included in

Promises1.7k
Auto-fetched 1 day ago

Related Projects

p-queuep-queue

Promise queue with concurrency control

Stars4,298
Forks227
Last commit6 days ago
p-limitp-limit

Run multiple promise-returning & async functions with limited concurrency

Stars2,934
Forks146
Last commit1 month ago
p-mapp-map

Map over promises concurrently

Stars1,517
Forks87
Last commit12 days ago
pifypify

Promisify a callback-style function

Stars1,502
Forks72
Last commit1 month ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub