{"name":"composition","description":"Compose generator and async/await middleware","version":"2.2.1","author":{"name":"Jonathan Ong","email":"me@jongleberry.com","url":"http://jongleberry.com"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/thenables/composition.git"},"dependencies":{"co":"^4.0.2","native-or-bluebird":"^1.1.2"},"devDependencies":{"bluebird":"^2.3.11","istanbul-harmony":"0","koa-compose":"^2.3.0","matcha":"^0.6.0","mocha":"2","timeout-then":"^1.0.0"},"scripts":{"bench":"matcha bench/run.js","test":"mocha --bail","test-cov":"istanbul cover ./node_modules/.bin/_mocha -- --reporter dot","test-travis":"istanbul cover ./node_modules/.bin/_mocha --report lcovonly -- --reporter dot"},"keywords":["co","compose","composition","middleware","decorator","decorators","async","await","yield"],"files":["index.js"],"gitHead":"08181c41cb5712ca0ef90042c0dab9f7f13b68ad","bugs":{"url":"https://github.com/thenables/composition/issues"},"homepage":"https://github.com/thenables/composition#readme","_id":"composition@2.2.1","_shasum":"cfad962b01b22b905efecbb2e4bbb6ab5f213724","_from":".","_npmVersion":"2.13.2","_nodeVersion":"2.5.0","_npmUser":{"name":"jongleberry","email":"jonathanrichardong@gmail.com"},"dist":{"shasum":"cfad962b01b22b905efecbb2e4bbb6ab5f213724","tarball":"http://registry-npm.ywwl.com/composition/download/composition-2.2.1.tgz","integrity":"sha512-UAqk0ZmOJULRDppgUeXRT6NZr1TWtTGq2kja1NzZZVbeEGVW8+ar39sk4APvKVqmadeI5vQlqw8rd6HfRKUyzg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCr1Eu9xWimcInsnxLYSrC65octVbx9KIq0dNe59B62HAIgE0/dGCA/cz/56XumWjzb4jyKFHGInsm6Pfv2rlZQuEY="}],"size":2871,"noattachment":false,"key":"/composition/-/composition-2.2.1.tgz"},"maintainers":[{"name":"jongleberry","email":"jonathanrichardong@gmail.com"},{"name":"coderhaoxin","email":"coderhaoxin@outlook.com"}],"readme":"\n# composition\n\n[![NPM version][npm-image]][npm-url]\n[![Build status][travis-image]][travis-url]\n[![Test coverage][coveralls-image]][coveralls-url]\n[![Dependency Status][david-image]][david-url]\n[![License][license-image]][license-url]\n[![Downloads][downloads-image]][downloads-url]\n\nCompose generator and async/await middleware like koa.\nAllows to use both generator functions and async/await functions.\n\n```js\nvar compose = require('composition');\n\nvar stack = [];\n\n// generator functions\nstack.push(function* (next) {\n  yield next;\n});\n\n// regular functions that return anything\n// but they should be promises!\nstack.push(function (next) {\n  return Promise.resolve(true);\n});\n\n// async/await functions\nstack.push(async function (next) {\n  return await Promise.resolve(true);\n});\n\n// compose it into a function\nvar fn = compose(stack);\n\n// this function returns a promise\nfn.call(this).then(function (val) {\n  console.log(val);\n}).catch(function (err) {\n  console.error(err.stack);\n  process.exit(1);\n})\n```\n\n[gitter-image]: https://badges.gitter.im/thenables/composition.png\n[gitter-url]: https://gitter.im/thenables/composition\n[npm-image]: https://img.shields.io/npm/v/composition.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/composition\n[github-tag]: http://img.shields.io/github/tag/thenables/composition.svg?style=flat-square\n[github-url]: https://github.com/thenables/composition/tags\n[travis-image]: https://img.shields.io/travis/thenables/composition.svg?style=flat-square\n[travis-url]: https://travis-ci.org/thenables/composition\n[coveralls-image]: https://img.shields.io/coveralls/thenables/composition.svg?style=flat-square\n[coveralls-url]: https://coveralls.io/r/thenables/composition\n[david-image]: http://img.shields.io/david/thenables/composition.svg?style=flat-square\n[david-url]: https://david-dm.org/thenables/composition\n[license-image]: http://img.shields.io/npm/l/composition.svg?style=flat-square\n[license-url]: LICENSE\n[downloads-image]: http://img.shields.io/npm/dm/composition.svg?style=flat-square\n[downloads-url]: https://npmjs.org/package/composition\n","publish_time":1440907059729,"_cnpm_publish_time":1440907059729,"dist-tags":{"latest":"2.3.0"}}