{"name":"p-tap","version":"3.1.0","description":"Tap into a promise chain without affecting its value or state","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/p-tap.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=8"},"scripts":{"test":"xo && ava && tsd"},"keywords":["promise","tap","debug","log","then","catch","error","chain","pipeline","thunk","function","async","await","promises","bluebird"],"devDependencies":{"ava":"^1.4.1","delay":"^4.1.0","time-span":"^3.0.0","tsd":"^0.7.2","xo":"^0.24.0"},"gitHead":"07e30957310ef5f1712b04d98e8b549912356f53","bugs":{"url":"https://github.com/sindresorhus/p-tap/issues"},"homepage":"https://github.com/sindresorhus/p-tap#readme","_id":"p-tap@3.1.0","_nodeVersion":"8.15.0","_npmVersion":"6.9.0","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"integrity":"sha512-xJSaeByOOQu5GnHEcnrxMkNi8O3Ez5X1wz8RT6wiL3mJFd4oXcSOvcKq+1CFUtuVYTSTWL/8rlkaCJRoR+L+NA==","shasum":"ceea85e92164e12b1c2b1caf78b4dc2ee51c9b5f","tarball":"http://registry-npm.ywwl.com/p-tap/download/p-tap-3.1.0.tgz","fileCount":5,"unpackedSize":5694,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcpY8TCRA9TVsSAnZWagAAnnQQAImRaEWEAI5Y3RUl180d\nUXso1s0xfbLb3+eAO65FBjp7kSg+qEVQpTgPp22LNXC579I9Y9qY4WZIoFZX\nZjv9nz1cy3D7kjIaNkgu8nwstWQMzKYc0ybvUIcHF59LOjXt+fLoMzaPY+r7\nJpX1PR8Lib9DxUGazKNy1TGpKot4JhmmsSQZTZI4LX8e3x6CiV6sg2Q8jg7M\nZwogxA8SaygStmP/DMUuEtkTuE45rD5TxJzPRoM2bkGCZIdpi8Xsg2N/TUkU\nOvBJfFk25XBQsCQVY+n7VhVDe0Ohasw2hTv+IqVwH2SsQfmWdG0JPaYo/Xe0\nBQVaMMYeT20utGE1XjZm9blrunHBgLnjJEpCgcKyghPYBh2WX01XDhLOlgEZ\nosV9ZVJnTXAbkiD6Wxc5/y5mTLu29NBJ7Mb10UGV8dSP3WM9mVsbG9s1YON2\n4jln4m0hkWGxvy8xe1usCmTLo6Y6Y9JeRZyjqh/79Xw95oEi7POWANoq1pF3\nPnZUw9eT/e2LuswX49KTUeP3o4daVWCZKv7dmBIFWJPcY35deX209XCdWMxg\ncCoZxp0H/Pi0b9xqvdgjNp/exdt0EHj+0Xb9x7oX5THK6kTCmwIDCggPGftG\nQELotnHJRi0Gyj2I3vlGrouiIgcbkBld4zHjwDFT8xB/QPuN0wNyBPbLrWCK\nbIqq\r\n=XIh0\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAkyMRCA79oglmSoJxWlgqySDGvezSPWGl0Ptm+IzzveAiAqpq8GH+XrPrFC4ykgKpNqX2mQJe8vNXG0A5u5vx0anQ=="}],"size":2242,"noattachment":false,"key":"/p-tap/-/p-tap-3.1.0.tgz"},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/p-tap_3.1.0_1554353939083_0.5701212277374763"},"_hasShrinkwrap":false,"readme":"# p-tap\n\n> Tap into a promise chain without affecting its value or state\n\n## Install\n\n```\n$ npm install p-tap\n```\n\n## Usage\n\n```js\nimport pTap from 'p-tap';\n\nPromise.resolve('unicorn')\n\t.then(pTap(console.log)) // Logs `unicorn`\n\t.then(value => {\n\t\t// `value` is still `unicorn`\n\t});\n```\n\n```js\nimport pTap from 'p-tap';\n\ngetUser()\n\t.then(pTap(user => recordStatsAsync(user))) // Stats are saved about `user` async before the chain continues\n\t.then(user => {\n\t\t// `user` is the user from getUser(), not recordStatsAsync()\n\t});\n```\n\n```js\nimport pTap from 'p-tap';\n\nPromise.resolve(() => doSomething())\n\t.catch(pTap.catch(console.error)) // Prints any errors\n\t.then(handleSuccess)\n\t.catch(handleError);\n```\n\n## API\n\n### pTap(tapHandler)\n\nUse this in a `.then()` method.\n\nReturns a [thunk](https://en.wikipedia.org/wiki/Thunk) that returns a `Promise`.\n\n### pTap.catch(tapHandler)\n\nUse this in a `.catch()` method.\n\nReturns a [thunk](https://en.wikipedia.org/wiki/Thunk) that returns a `Promise`.\n\n#### tapHandler\n\nType: `Function`\n\nAny return value is ignored. Exceptions thrown in `tapHandler` are relayed back to the original promise chain.\n\nIf `tapHandler` returns a `Promise`, it will be awaited before passing through the original value.\n\n## Related\n\n- [p-log](https://github.com/sindresorhus/p-log) - Log the value/error of a promise\n- [p-if](https://github.com/sindresorhus/p-if) - Conditional promise chains\n- [p-catch-if](https://github.com/sindresorhus/p-catch-if) - Conditional promise catch handler\n- [More…](https://github.com/sindresorhus/promise-fun)\n","publish_time":1554353939272,"_cnpm_publish_time":1554353939272,"dist-tags":{"latest":"4.0.0"}}