{"_id":"koa-unless","_rev":"19-3af5d41b15a053a1c3d7dd527fcb06bc","name":"koa-unless","description":"Conditionally add a middleware to Koa with some common patterns.","dist-tags":{"latest":"1.0.7"},"versions":{"0.0.1":{"name":"koa-unless","version":"0.0.1","description":"Conditionally add a middleware to Koa with some common patterns.","main":"index.js","scripts":{"test":"make test"},"keywords":["koa","middleware"],"author":{"name":"Jesus Rodriguez"},"license":"MIT","devDependencies":{"koa":"^0.21.0","mocha":"^2.2.5","supertest":"^1.0.1"},"gitHead":"1c62a9738f10e3f55305c9e4a2b2ddce2c73e51d","_id":"koa-unless@0.0.1","_shasum":"cfcdd1cdfbaf066e05d843e6a412df8a7c69b218","_from":".","_npmVersion":"2.9.0","_nodeVersion":"2.0.1","_npmUser":{"name":"foxandxss","email":"Foxandxss@gmail.com"},"dist":{"shasum":"cfcdd1cdfbaf066e05d843e6a412df8a7c69b218","tarball":"https://registry.npmjs.org/koa-unless/-/koa-unless-0.0.1.tgz","integrity":"sha512-WNFizdadYQ9VEpeb013W5bTvDY/Qm9TnQvrkdzqSOAjCrD/3UywlrRHoBaPYe3zL9eKg1DwCWACEERXpnYMnHg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBiODQrkYGYUhvwMUxh81/DayP+QUH9Rz4WoC1YYYfCkAiAEodJgsR8B98hbiJ/i3/zHaGDnHMxo/NMAP+9EVFfZDQ=="}]},"maintainers":[{"name":"foxandxss","email":"Foxandxss@gmail.com"}]},"1.0.0":{"name":"koa-unless","version":"1.0.0","description":"Conditionally add a middleware to Koa with some common patterns.","main":"index.js","scripts":{"test":"make test"},"keywords":["koa","middleware","unless"],"author":{"name":"Jesus Rodriguez","email":"Foxandxss@gmail.com"},"repository":{"type":"git","url":"git+https://github.com/Foxandxss/koa-unless.git"},"license":"MIT","devDependencies":{"koa":"^2.0.0","mocha":"^2.2.5","supertest":"^1.0.1"},"gitHead":"8b02f403d0bb3e4ab3dae79a264198e010836536","bugs":{"url":"https://github.com/Foxandxss/koa-unless/issues"},"homepage":"https://github.com/Foxandxss/koa-unless#readme","_id":"koa-unless@1.0.0","_shasum":"5aa57384bc882568afc90ac04852a3d58658aeeb","_from":".","_npmVersion":"3.8.3","_nodeVersion":"5.10.1","_npmUser":{"name":"foxandxss","email":"Foxandxss@gmail.com"},"dist":{"shasum":"5aa57384bc882568afc90ac04852a3d58658aeeb","tarball":"https://registry.npmjs.org/koa-unless/-/koa-unless-1.0.0.tgz","integrity":"sha512-j8xqeJEZiiuR5mIbUYcoxFIluD5VfMPJN06yJhTSlSrrnsDxT9lBcbxlRv60hvaEbBCJrC9Wcvvo0xJ06EtoEw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHd99lstdkdYfLRsMs0kOoY/7hSGvdmLJND8X3PDzY/UAiEAnK+buTBODGhZVh0Ga2HVmXU+NWsxHkhZft6UhO2VnJI="}]},"maintainers":[{"name":"foxandxss","email":"Foxandxss@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/koa-unless-1.0.0.tgz_1461859290419_0.5372268890496343"}},"1.0.5":{"name":"koa-unless","version":"1.0.5","description":"Conditionally add a middleware to Koa with some common patterns.","main":"index.js","scripts":{"test":"make test"},"keywords":["koa","middleware","unless"],"author":{"name":"Jesus Rodriguez","email":"Foxandxss@gmail.com"},"repository":{"type":"git","url":"git+https://github.com/Foxandxss/koa-unless.git"},"license":"MIT","devDependencies":{"koa":"^2.0.0","mocha":"^2.2.5","supertest":"^1.0.1"},"gitHead":"cb3fd99bccd4486fcea21f01f522fe87546d03e8","bugs":{"url":"https://github.com/Foxandxss/koa-unless/issues"},"homepage":"https://github.com/Foxandxss/koa-unless#readme","_id":"koa-unless@1.0.5","_shasum":"83c0558c021dee78a74d6064908102619e559dfa","_from":".","_npmVersion":"4.0.5","_nodeVersion":"7.4.0","_npmUser":{"name":"brunokrebs","email":"me@brunokrebs.com"},"dist":{"shasum":"83c0558c021dee78a74d6064908102619e559dfa","tarball":"https://registry.npmjs.org/koa-unless/-/koa-unless-1.0.5.tgz","integrity":"sha512-0hTJCGiWy1hZ3PPH4jehI+8o6EymM7k+COlrpyePKs5/XtAIvLBDZWPu25GYJbF/Xx/Vx/FebeZVXehtN40cXA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIA+TAR6ts+9QUMNZo75dR6dblvkcysAITiRshGRCVt1uAiBwQNHTQKIGDAh6ITCpcJTrdxSxtHEZ4+4qisS4glMvYg=="}]},"maintainers":[{"name":"brunokrebs","email":"me@brunokrebs.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/koa-unless-1.0.5.tgz_1490393038097_0.48799319635145366"}},"1.0.6":{"name":"koa-unless","version":"1.0.6","description":"Conditionally add a middleware to Koa with some common patterns.","main":"index.js","scripts":{"test":"make test"},"keywords":["koa","middleware","unless"],"author":{"name":"Jesus Rodriguez","email":"Foxandxss@gmail.com"},"repository":{"type":"git","url":"git+https://github.com/Foxandxss/koa-unless.git"},"license":"MIT","devDependencies":{"koa":"^2.0.0","mocha":"^2.2.5","supertest":"^1.0.1"},"gitHead":"84d5aca4b1481433f337ec875b083394736556fb","bugs":{"url":"https://github.com/Foxandxss/koa-unless/issues"},"homepage":"https://github.com/Foxandxss/koa-unless#readme","_id":"koa-unless@1.0.6","_shasum":"6f4b2387bf11f09d56ffea375b4d0a79f2602963","_from":".","_npmVersion":"4.0.5","_nodeVersion":"7.4.0","_npmUser":{"name":"brunokrebs","email":"me@brunokrebs.com"},"dist":{"shasum":"6f4b2387bf11f09d56ffea375b4d0a79f2602963","tarball":"https://registry.npmjs.org/koa-unless/-/koa-unless-1.0.6.tgz","integrity":"sha512-gkzbL4yPiYEQav9Rh5u5URRiMbSLjXn853Rh5lus6WP/9KMRt+8izGsHMEOrLbzf7o25vKc9VMr9nKIAL206Sw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIE4MG9OhUv0REWDYcTjgmo7pm6mxz3i/Bap/B6sq/TobAiBAFIj4RNts8ONHi+ODCIohslOodT7kIPjTN/Hlk0NUFA=="}]},"maintainers":[{"name":"brunokrebs","email":"me@brunokrebs.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/koa-unless-1.0.6.tgz_1490393263610_0.4654028946533799"}},"0.0.2":{"name":"koa-unless","version":"0.0.2","description":"Conditionally add a middleware to Koa with some common patterns.","main":"index.js","scripts":{"test":"make test"},"keywords":["koa","middleware"],"author":{"name":"Jesus Rodriguez","email":"Foxandxss@gmail.com"},"repository":{"type":"git","url":"git+https://github.com/Foxandxss/koa-unless.git"},"license":"MIT","devDependencies":{"koa":"^0.21.0","mocha":"^2.2.5","supertest":"^1.0.1"},"gitHead":"cc2320273144b5fbc69e1d202fcf98568fe0e5eb","bugs":{"url":"https://github.com/Foxandxss/koa-unless/issues"},"homepage":"https://github.com/Foxandxss/koa-unless#readme","_id":"koa-unless@0.0.2","_shasum":"98a62dc22285f7c601ed048f1e4a72c7c14d6f85","_from":".","_npmVersion":"4.0.5","_nodeVersion":"7.4.0","_npmUser":{"name":"brunokrebs","email":"me@brunokrebs.com"},"dist":{"shasum":"98a62dc22285f7c601ed048f1e4a72c7c14d6f85","tarball":"https://registry.npmjs.org/koa-unless/-/koa-unless-0.0.2.tgz","integrity":"sha512-kBmzns8UOBKUwoOvC3qsOAia5fD+My2WEJkJ3TfOUP1Inz6prlB+0tep88UFkb19y1TDFDWc9nXmzvZ635Bsrw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFCTeFG7VT3Xfjh6TilB8xeXRRQz+7+jSu6KG94uvz5KAiEAmFyCCuXfGf9Ok9fJjpvQ8JvjmiyyVO9EjbQQ6zVJ9tE="}]},"maintainers":[{"name":"brunokrebs","email":"me@brunokrebs.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/koa-unless-0.0.2.tgz_1490396631995_0.9373461725190282"}},"1.0.7":{"name":"koa-unless","version":"1.0.7","description":"Conditionally add a middleware to Koa with some common patterns.","main":"index.js","scripts":{"test":"make test"},"keywords":["koa","middleware","unless"],"author":{"name":"Jesus Rodriguez","email":"Foxandxss@gmail.com"},"repository":{"type":"git","url":"git+https://github.com/Foxandxss/koa-unless.git"},"license":"MIT","devDependencies":{"koa":"^2.0.1","mocha":"^2.2.5","supertest":"^1.0.1"},"gitHead":"d6b0c81f1c73f6a7a83e87bde889db45ca9a0875","bugs":{"url":"https://github.com/Foxandxss/koa-unless/issues"},"homepage":"https://github.com/Foxandxss/koa-unless#readme","_id":"koa-unless@1.0.7","_shasum":"b9df375e2b4da3043918d48622520c2c0b79f032","_from":".","_npmVersion":"4.0.5","_nodeVersion":"7.4.0","_npmUser":{"name":"brunokrebs","email":"me@brunokrebs.com"},"dist":{"shasum":"b9df375e2b4da3043918d48622520c2c0b79f032","tarball":"https://registry.npmjs.org/koa-unless/-/koa-unless-1.0.7.tgz","integrity":"sha512-NKiz+nk4KxSJFskiJMuJvxeA41Lcnx3d8Zy+8QETgifm4ab4aOeGD3RgR6bIz0FGNWwo3Fz0DtnK77mEIqHWxA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC8Pb5PLk2nisrBpg/KMjegqS3gblrJ0zbghi0Vhn/PVgIhAP2TB9S8T04ak0ZH7JIKGjM3tSFiOoqbcF4y9Ejm4czx"}]},"maintainers":[{"name":"brunokrebs","email":"me@brunokrebs.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/koa-unless-1.0.7.tgz_1490398327714_0.10381491691805422"}}},"readme":"# Koa Unless\n\n![Build Status](https://travis-ci.org/Foxandxss/koa-unless.svg?branch=master)\n\nConditionally skip a middleware when a condition is met.\n\n## Install\n\n\tnpm i koa-unless --save\n\n## Usage\n\nWith existing middlewares:\n\n```javascript\nvar unless = require('koa-unless');\nvar serve  = require('koa-static');\n\nvar static = serve(__dirname + '/public');\nstatic.unless = unless;\n\napp.use(static.unless({ method: 'OPTIONS' }));\n```\n\nIf you are authoring a middleware you can support unless as follow:\n\n```javascript\nmodule.exports = function () {\n  var mymid = function(ctx, next) {\n\t// Do something\n  };\n\n  mymid.unless = require('koa-unless');\n\n  return mymid;\n};\n```\n\n## Current options\n\n-  `method` it could be an string or an array of strings. If the request method match the middleware will not run.\n-  `path` it could be an string, a regexp or an array of any of those. If the request path match, the middleware will not run.\n-  `ext` it could be an string or an array of strings. If the request path ends with one of these extensions the middleware will not run.\n-  `custom` it must be a function that returns `true` / `false`. If the function returns true for the given request, ithe middleware will not run. The function will have access to Koa's context via `this`\n-  `useOriginalUrl` it should be `true` or `false`, default is `true`. if false, `path` will match against `ctx.url` instead of `ctx.originalUrl`.\n\n\n## Examples\n\nRequire authentication for every request unless the path is index.html.\n\n```javascript\napp.use(requiresAuth.unless({ path: ['/index.html', '/'] }))\n```\n\nAvoid a fstat for request to routes doesnt end with a given extension.\n\n```javascript\napp.use(static.unless(function () {\n  var ext = url.parse(this.originalUrl).pathname.substr(-4);\n  return !~['.jpg', '.html', '.css', '.js'].indexOf(ext);\n}));\n```\n\n## Credits\n\nAll the credits for this library goes for [José F. Romaniello](https://github.com/jfromaniello) which created the original [express version](https://github.com/jfromaniello/express-unless).\n\n## License\n\nMIT 2015 - Jesús Rodríguez\n","maintainers":[{"name":"brunokrebs","email":"me@brunokrebs.com"}],"time":{"modified":"2022-06-19T09:31:25.006Z","created":"2015-05-27T11:52:37.232Z","0.0.1":"2015-05-27T11:52:37.232Z","1.0.0":"2016-04-28T16:01:32.688Z","1.0.1":"2017-03-17T17:37:12.115Z","1.0.2":"2017-03-20T22:16:21.976Z","1.0.3":"2017-03-20T22:34:48.602Z","1.0.4":"2017-03-24T21:46:35.436Z","1.0.5":"2017-03-24T22:03:58.355Z","1.0.6":"2017-03-24T22:07:43.921Z","0.0.2":"2017-03-24T23:03:52.251Z","1.0.7":"2017-03-24T23:32:07.950Z"},"keywords":["koa","middleware","unless"],"author":{"name":"Jesus Rodriguez","email":"Foxandxss@gmail.com"},"license":"MIT","readmeFilename":"README.md","users":{"neofreko":true,"holly":true},"homepage":"https://github.com/Foxandxss/koa-unless#readme","repository":{"type":"git","url":"git+https://github.com/Foxandxss/koa-unless.git"},"bugs":{"url":"https://github.com/Foxandxss/koa-unless/issues"}}