{"_id":"express-params","_rev":"10-d2fdad02f0fc2714cf731d938bd09679","name":"express-params","description":"Express param functions","dist-tags":{"latest":"0.0.3"},"versions":{"0.0.1":{"name":"express-params","version":"0.0.1","description":"Express param functions","keywords":["express"],"author":{"name":"TJ Holowaychuk","email":"tj@vision-media.ca"},"dependencies":{},"devDependencies":{"express":"2.3.7","should":"0.2.1","expresso":"0.7.6"},"main":"index","engines":{"node":"0.4.x"},"_id":"express-params@0.0.1","_engineSupported":true,"_npmVersion":"1.0.3","_nodeVersion":"v0.4.8","_defaultsLoaded":true,"dist":{"shasum":"66a019793c41fcb52fca5a9fa54f5eaf6fba749f","tarball":"https://registry.npmjs.org/express-params/-/express-params-0.0.1.tgz","integrity":"sha512-QOv52hlbMaEmy5wvQhtI80iQifpkwJzb1rndjYvlYL2cBJ5UloHRyXNvoci3wOubduMpI61FnUlUblxu32BrfA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBzo9S/F4PiAzmobrlVyas0vfGhNSgHHjXUOylJ6gpfkAiB9yVouLkwdbVpSAEL/WVRDwrlNsxwUY0LT/rk90G1Ijg=="}]},"scripts":{}},"0.0.2":{"name":"express-params","version":"0.0.2","description":"Express param functions","keywords":["express"],"author":{"name":"TJ Holowaychuk","email":"tj@vision-media.ca"},"dependencies":{},"devDependencies":{"express":"2.5.x","should":"0.3.x","expresso":"0.9.x"},"main":"index","engines":{"node":"0.6.x"},"_npmUser":{"name":"tjholowaychuk","email":"tj@vision-media.ca"},"_id":"express-params@0.0.2","_engineSupported":true,"_npmVersion":"1.0.106","_nodeVersion":"v0.6.5","_defaultsLoaded":true,"dist":{"shasum":"00c4c22c5fef350590ae6eb11e9f678551d8a698","tarball":"https://registry.npmjs.org/express-params/-/express-params-0.0.2.tgz","integrity":"sha512-T2Hwc5uCycsLankCdwlruNdXYDEsgB9VsxObR4oeldbbkAtIz9QfkZ0yxpOlF2UaW8VUTeJU2LOKBrcsEQdi/Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGPoD+aMrzQTt/uto1BKyEnygLohlduXBbQlgzwyxek1AiAkoDZjYQCDVxdzrjX00y/bl7oTYJ95igCutTGwD4O+pg=="}]},"maintainers":[{"name":"tjholowaychuk","email":"tj@vision-media.ca"}]},"0.0.3":{"name":"express-params","version":"0.0.3","description":"Express param functions","keywords":["express"],"author":{"name":"TJ Holowaychuk","email":"tj@vision-media.ca"},"dependencies":{},"devDependencies":{"express":"2.5.x","should":"0.3.x","expresso":"0.9.x"},"main":"index","_id":"express-params@0.0.3","dist":{"shasum":"1880259bdd7a250e2aceca8a71b98cd5ac5a50b7","tarball":"https://registry.npmjs.org/express-params/-/express-params-0.0.3.tgz","integrity":"sha512-dXlgynfGPMa7ifW9d6WHXDmfKyCKdC2PLmFyI/LbJbp3SJi9P6DWUDNmZhCe8iUk1zp0MRW9yASzWuPECDsWqA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIE1r9IT3cSAT2PCc6A+cuzyj4QRH3SCeNwUycriRRIQEAiAt6u0WrSqjkRuiH1vaSSEWCtYHuwxXXmhqytmrj/6u2w=="}]},"readme":"\n# express-params\n\n  Express param pre-condition functions.\n\n## Installation\n\n Works with Express 2.5.x\n\n    $ npm install express-params\n\n## Usage\n\n Simply invoke the `extend()` method on an express `HTTPServer` to add this functionality.\n\n```javascript\nvar express = require('express')\n  , params = require('express-params')\n  , app = express.createServer();\n\nparams.extend(app);\n```\n\n## RegExp\n\n  Regular expressions can be used to extract data from pathname\n  segments as shown below. When matched `req.params.range` contains\n  the capture groups of the `regexp.exec()` call.\n\n```javascript\napp.param('range', /^(\\w+)\\.\\.(\\w+)?$/);\n\napp.get('/range/:range', function(req, res, next){\n  var range = req.params.range;\n  res.send('from ' + range[1] + ' to ' + range[2]);\n});\n```\n\n  Another use-case for regular expression parameters is to validate input,\n  for example here we may want to route via numeric id, followed by a route\n  which will accept other values.\n\n```javascript\napp.param('uid', /^[0-9]+$/);\n\napp.get('/user/:uid', function(req, res, next){\n  var uid = req.params.uid;\n  res.send('user ' + uid);\n});\n\napp.get('/user/:name', function(req, res, next){\n  var name = req.params.name;\n  res.send('user ' + name);\n});\n```\n\n## Return Value\n\n  Functions with arity < 3 (less than three parameters) are not\n  considered to be middleware-style, and are useful for type coercion.\n  For example below we pass `Number`, a function which accepts a string coercing to a number, alternatively we could use `parseInt` here. The result of `req.params.id` will then be a number, however if we were to issue `GET /user/tj` the result would be `NaN`, which is considered invalid by `exports.invalidParamReturnValue(val)` so `next('route')` is called, ignoring the route.\n\n```javascript\napp.param('id', Number);\n\napp.get('/user/:id', function(req, res, next){\n  var id = req.params.id;\n  res.send('typeof ' + typeof id + ' ' + id);\n});\n```\n\n  The following default logic is applied to test if a return value is invalid:\n\n```javascript  \nreturn null == val\n  || false === val\n  || ('number' == typeof val && isNaN(val));\n```\n\n It's safe to throw in these functions, as connect's router wraps them in a try/catch block, and they are not asynchronous.\n\n## Running Tests\n\n First install dependencies:\n \n     $ npm install -g\n\n Then run the tests:\n \n     $ make test\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2011 TJ Holowaychuk &lt;tj@vision-media.ca&gt;\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.","maintainers":[{"name":"tjholowaychuk","email":"tj@vision-media.ca"}]}},"maintainers":[{"name":"tjholowaychuk","email":"tj@vision-media.ca"}],"time":{"modified":"2022-06-17T22:29:54.042Z","created":"2011-05-23T23:56:03.294Z","0.0.1":"2011-05-23T23:56:03.859Z","0.0.2":"2011-12-16T17:18:24.238Z","0.0.3":"2012-06-26T16:13:27.221Z"},"author":{"name":"TJ Holowaychuk","email":"tj@vision-media.ca"},"users":{"bojand":true}}