{"name":"p-tap","version":"1.0.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":">=4"},"scripts":{"test":"xo && ava"},"files":["index.js"],"keywords":["promise","tap","debug","log","then","catch","error","chain","pipeline","thunk","function","async","await","promises","bluebird"],"devDependencies":{"ava":"*","delay":"^1.3.1","time-span":"^1.0.0","xo":"*"},"xo":{"esnext":true},"gitHead":"a6c20105b632b319688c652d29f7c8d6df35b7ab","bugs":{"url":"https://github.com/sindresorhus/p-tap/issues"},"homepage":"https://github.com/sindresorhus/p-tap#readme","_id":"p-tap@1.0.0","_shasum":"dc4fa086135e8688226f6e7dccea67d8322d08df","_from":".","_npmVersion":"2.15.9","_nodeVersion":"4.6.0","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"dc4fa086135e8688226f6e7dccea67d8322d08df","tarball":"http://registry-npm.ywwl.com/p-tap/download/p-tap-1.0.0.tgz","integrity":"sha512-rcKGxEJhFBVPeiioaUOeXTSGABbqkuIg/jrft7ou4RqZbT2O6v99I+7GCc4QCgcmxGRigkcsUUPGRRhyMVzb7A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBfUX5XGBlIxFI0PxzYv4/aWZeNS09vwD7N3QPhRFax/AiAeOeBgCE3dQbY+UcL0GCOs70t1/lkDjP6gd7dTim1O2Q=="}],"size":1969,"noattachment":false,"key":"/p-tap/-/p-tap-1.0.0.tgz"},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/p-tap-1.0.0.tgz_1477033910858_0.032033002469688654"},"directories":{},"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":1477033911074,"_cnpm_publish_time":1477033911074,"dist-tags":{"latest":"4.0.0"}}