{"name":"p-tap","version":"2.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":">=6"},"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":"^3.0.0","time-span":"^2.0.0","xo":"*"},"gitHead":"015511ce89362eed892731f9b7e3441d9d6a4a72","bugs":{"url":"https://github.com/sindresorhus/p-tap/issues"},"homepage":"https://github.com/sindresorhus/p-tap#readme","_id":"p-tap@2.0.0","_npmVersion":"5.6.0","_nodeVersion":"8.11.2","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"integrity":"sha512-1Sx7oTf+uOXmNOQ1YUVl3h7Va8dIlh/8pBFc3P4hyrM5WaeiAGajG0b3uLx6yOIhuE6MVPsb4kKrBzv7HSorUQ==","shasum":"a1b526946a3c22e94b4bca9d22d117049ca0ee09","tarball":"http://registry-npm.ywwl.com/p-tap/download/p-tap-2.0.0.tgz","fileCount":4,"unpackedSize":3804,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbG6KBCRA9TVsSAnZWagAAGmYQAIinkjhJpkF4tbNkqMt8\nqeRB88jn6jFC5Q1ni+GQE4rqMdpIrhk+CENnqbvYI05+9VcoAJiYphoS+4oV\nkkGJjmKqRWMcPbKaWP2TkWdEgqb4Y8F7jGNfl3/TqEhJgUAwUDo1a+PI0b7s\njd8+nym+LEcO9Zx7PafwZPqtths+L1GpOYSUF4zFSMixovL2zWeWAnAEnjC2\n5fB2ka4h/OcoFqre1xIDZJTLcJHRd1dWleJTxFwMUX1EdI/2K8QyXM/JMv7S\nEu6DEwnBcIp8rcgNT+huBW5cKx95rqeEc8bhkXP4QAUYilZT213HEwr4O13E\n0kpZzbBmDNvSho/XZ0iivDmE44VaM5/4ysfyqSxI/MiZ+P5q+HdDOUz26pPq\nCMSliOrAdsZr+HqbrXiaV01p0TDPgb4BQ47GDp5Hv4le71OwJDW8b205irRK\ni1nLdxvgGDaY4vPk5BjfPk7wtpUw35ewqGX/jUVY6qw0MSqdknY4SzbQ5lHa\nHEWvmkDkgHbDAENdlgtK9/q0yQRkpzaGkPBWgEPh7ApTSdT+yV3byV8N3pCH\nWcrn5vxJWeSRUpRz9nx45yK1FZMZ5bRxucqdE6fE25Ay4+v8N7yJmXpblwzJ\nbA1P+o1tPWW1c1V0KgnQrtsFFexc9w7l2o/JM+JhMIfHp1Z7APYylHDmcNvV\nicNK\r\n=BhMT\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCID0FEZQHs9g+kwtAnZY79uoPGz61McVu8tCxWNndprC9AiEA2pGeYQXCNedVIIoL9R/oqp3xAfYl6F8IECRvDEpQfY4="}],"size":1952,"noattachment":false,"key":"/p-tap/-/p-tap-2.0.0.tgz"},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/p-tap_2.0.0_1528537728379_0.3228461270617924"},"_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":1528537728470,"_cnpm_publish_time":1528537728470,"dist-tags":{"latest":"4.0.0"}}