{"name":"throwback","version":"4.1.0","description":"Simple asynchronous middleware pattern","main":"dist/index.js","typings":"dist/index.d.ts","scripts":{"prettier":"prettier --write","lint":"tslint \"src/**/*.ts\" --project tsconfig.json","format":"npm run prettier -- README.md \"src/**/*.{js,ts}\"","build":"rimraf dist && tsc","specs":"jest --coverage","test":"npm run -s lint && npm run -s build && npm run -s specs && npm run -s size","prepare":"npm run build","size":"size-limit"},"repository":{"type":"git","url":"git://github.com/serviejs/throwback.git"},"keywords":["middleware","async","compose","promise","ware","layer"],"author":{"name":"Blake Embrey","email":"hello@blakeembrey.com","url":"http://blakeembrey.me"},"license":"MIT","bugs":{"url":"https://github.com/serviejs/throwback/issues"},"homepage":"https://github.com/serviejs/throwback","size-limit":[{"path":"./dist/index.js","limit":"90 B"}],"jest":{"roots":["<rootDir>/src/"],"transform":{"\\.tsx?$":"ts-jest"},"testRegex":"(/__tests__/.*|\\.(test|spec))\\.(tsx?|jsx?)$","moduleFileExtensions":["ts","tsx","js","jsx","json","node"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"lint-staged":{"*.{js,json,css,md}":["npm run prettier","git add"]},"publishConfig":{"access":"public"},"devDependencies":{"@types/jest":"^24.0.13","@types/node":"^12.0.7","husky":"^2.4.0","jest":"^24.8.0","lint-staged":"^8.2.0","prettier":"^1.18.2","rimraf":"^2.6.2","size-limit":"^1.3.6","ts-jest":"^24.0.2","tslint":"^5.10.0","tslint-config-prettier":"^1.18.0","tslint-config-standard":"^8.0.1","typescript":"^3.0.3"},"gitHead":"8b458313ae7489562c78b7bb36943bfc859f17c7","_id":"throwback@4.1.0","_nodeVersion":"12.3.1","_npmVersion":"6.9.0","dist":{"integrity":"sha512-dLFe8bU8SeH0xeqeKL7BNo8XoPC/o91nz9/ooeplZPiso+DZukhoyZcSz9TFnUNScm+cA9qjU1m1853M6sPOng==","shasum":"421aac7ba9eff473105385ac4a2b0130d4b0a59c","tarball":"http://registry-npm.ywwl.com/throwback/download/throwback-4.1.0.tgz","fileCount":9,"unpackedSize":26851,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc/Y95CRA9TVsSAnZWagAAEVMP/2tk8Pg1Cg5ppidoREB5\nn1VrO3nWtSrkqpHMAbe7WQNyIyePJJo1lh0ioSgv+KE8TDNBP4yy1PZbvQ1b\nWtQaThR7ZANKBXmCYolw5t4huaC+gbnneRzuVWY/SNwv/k0YLVDs+lkSzplR\nou3KXGM3uwbNq9jzQK7hkWAUWTQQWdMrChHwNeDybKs7xurBB+w9YPPL0R9Z\nzUOaMbC9XcrccA3+9lnUTqoG+IzF+6w5b8LHX9NeB1QGZmEQFWW0tJAjHZ+g\nIMpL0UDgBRrAb5vML1Ig7afEBmA6z2JRm2X8HrDQ3GMQPBCB9QKMzn4+P7+U\nfE9BqBkjUmYp3Fs9/d2ECpRpxRrQgIDdoBEc8l7kg0RfcRb2ThuKVsMR5vwF\nCTaSo0F1UlI3kOPiCDQGiosaa8Pj3GhELI8bp1WEqVZf13hlpUBAt2tLNiSC\nzQpX+dHsJApLRVi3yCUV57JxeBAE/T5Nmx1ZAfmannqGkfoK+qCnoTvTNdx2\nGfiO+BlfFAsNKpH6VmBnQI3ppsErJZPze/sJ9oUPPYsd4Y1Qf2KVV5vP2X53\nkiIf4HkhLbGzAnkC6vrA8o3QXnRzSSi0mCgBl16lKduP/cZK+9qPbUbUX2B2\nc5PIeyIh0zfwg+4vO2VLqT7pJFW1OarSnjyqU+39ZiSWwIPjB5fRABNB3b+o\nHHGp\r\n=FKYT\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGbfFlNA9Nu9DsSh3i+OYOEDGHwKFH1YJXGblSBdHDrhAiBmYhfhHjknvG7AGeHZFK4hE1WFiiloOg7b9CgUR+QQmA=="}],"size":6908,"noattachment":false,"key":"/throwback/-/throwback-4.1.0.tgz"},"maintainers":[{"name":"blakeembrey","email":"hello@blakeembrey.com"}],"_npmUser":{"name":"blakeembrey","email":"hello@blakeembrey.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/throwback_4.1.0_1560121208529_0.10463905278013441"},"_hasShrinkwrap":false,"readme":"# Throwback\n\n[![NPM version](https://img.shields.io/npm/v/throwback.svg?style=flat)](https://npmjs.org/package/throwback)\n[![NPM downloads](https://img.shields.io/npm/dm/throwback.svg?style=flat)](https://npmjs.org/package/throwback)\n[![Build status](https://img.shields.io/travis/serviejs/throwback.svg?style=flat)](https://travis-ci.org/serviejs/throwback)\n[![Test coverage](https://img.shields.io/coveralls/serviejs/throwback.svg?style=flat)](https://coveralls.io/r/serviejs/throwback?branch=master)\n\n> Simple asynchronous middleware pattern.\n\n## Installation\n\n```\nnpm install throwback --save\n```\n\n## Usage\n\nCompose asynchronous (promise-returning) functions.\n\n```js\nconst { compose } = require(\"throwback\");\n\nconst fn = compose([\n  async function(ctx, next) {\n    console.log(1);\n\n    try {\n      await next();\n    } catch (err) {\n      console.log(\"throwback\", err);\n    }\n\n    console.log(4);\n  },\n  async function(ctx, next) {\n    console.log(2);\n\n    return next();\n  }\n]);\n\n// Callback runs at the end of the stack, before\n// the middleware bubbles back to the beginning.\nfn({}, function(ctx) {\n  console.log(3);\n\n  ctx.status = 404;\n});\n```\n\n**Tip:** In development (`NODE_ENV !== \"production\"`), `compose` will throw errors when you do something unexpected. In production, the faster non-error code paths are used.\n\n### Example\n\nBuild a micro HTTP server!\n\n```js\nconst { createServer } = require(\"http\");\nconst finalhandler = require(\"finalhandler\"); // Example only, not compatible with single `ctx` arg.\nconst { compose } = require(\"throwback\");\n\nconst app = compose([\n  function({ req, res }, next) {\n    res.end(\"Hello world!\");\n  }\n]);\n\ncreateServer(function(req, res) {\n  return app({ req, res }, finalhandler());\n}).listen(3000);\n```\n\n## Use Cases\n\n- HTTP requests (e.g. [`popsicle`](https://github.com/serviejs/popsicle))\n- HTTP servers (e.g. [`servie`](https://github.com/serviejs/servie))\n- Processing pipelines (e.g. [`scrappy`](https://github.com/blakeembrey/node-scrappy))\n\n## Inspiration\n\nBuilt for [`servie`](https://github.com/serviejs) and inspired by [`koa-compose`](https://github.com/koajs/compose).\n\n## License\n\nMIT\n","publish_time":1560121208648,"_cnpm_publish_time":1560121208648,"dist-tags":{"latest":"4.1.0"}}