{"name":"parseurl","description":"parse a url with memoization","version":"1.3.0","author":{"name":"Jonathan Ong","email":"me@jongleberry.com","url":"http://jongleberry.com"},"contributors":[{"name":"Douglas Christopher Wilson","email":"doug@somethingdoug.com"}],"repository":{"type":"git","url":"https://github.com/expressjs/parseurl"},"license":"MIT","devDependencies":{"benchmark":"1.0.0","beautify-benchmark":"0.2.4","fast-url-parser":"~1.0.0","istanbul":"0.3.0","mocha":"~1.21.4"},"scripts":{"bench":"node benchmark/index.js","test":"mocha --check-leaks --bail --reporter spec test/","test-cov":"istanbul cover node_modules/mocha/bin/_mocha -- --check-leaks --reporter dot test/","test-travis":"istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --check-leaks --reporter spec test/"},"readme":"# parseurl\n\n[![NPM version](https://badge.fury.io/js/parseurl.svg)](http://badge.fury.io/js/parseurl)\n[![Build Status](https://travis-ci.org/expressjs/parseurl.svg?branch=master)](https://travis-ci.org/expressjs/parseurl)\n[![Coverage Status](https://img.shields.io/coveralls/expressjs/parseurl.svg?branch=master)](https://coveralls.io/r/expressjs/parseurl)\n\nParse a URL with memoization.\n\n## Install\n\n```bash\n$ npm install parseurl\n```\n\n## API\n\n```js\nvar parseurl = require('parseurl')\n```\n\n### parseurl(req)\n\nParse the URL of the given request object (looks at the `req.url` property)\nand return the result. The result is the same as `url.parse` in Node.js core.\nCalling this function multiple times on the same `req` where `req.url` does\nnot change will return a cached parsed object, rather than parsing again.\n\n### parseurl.original(req)\n\nParse the original URL of the given request object and return the result.\nThis works by trying to parse `req.originalUrl` if it is a string, otherwise\nparses `req.url`. The result is the same as `url.parse` in Node.js core.\nCalling this function multiple times on the same `req` where `req.originalUrl`\ndoes not change will return a cached parsed object, rather than parsing again.\n\n## Benchmark\n\n```bash\n$ npm run-script bench\n\n> parseurl@1.3.0 bench nodejs-parseurl\n> node benchmark/index.js\n\n> node benchmark/fullurl.js\n\n  Parsing URL \"http://localhost:8888/foo/bar?user=tj&pet=fluffy\"\n\n  1 test completed.\n  2 tests completed.\n  3 tests completed.\n\n  fasturl   x 1,290,780 ops/sec ±0.46% (195 runs sampled)\n  nativeurl x    56,401 ops/sec ±0.22% (196 runs sampled)\n  parseurl  x    55,231 ops/sec ±0.22% (194 runs sampled)\n\n> node benchmark/pathquery.js\n\n  Parsing URL \"/foo/bar?user=tj&pet=fluffy\"\n\n  1 test completed.\n  2 tests completed.\n  3 tests completed.\n\n  fasturl   x 1,986,668 ops/sec ±0.27% (190 runs sampled)\n  nativeurl x    98,740 ops/sec ±0.21% (195 runs sampled)\n  parseurl  x 2,628,171 ops/sec ±0.36% (195 runs sampled)\n\n> node benchmark/samerequest.js\n\n  Parsing URL \"/foo/bar?user=tj&pet=fluffy\" on same request object\n\n  1 test completed.\n  2 tests completed.\n  3 tests completed.\n\n  fasturl   x  2,184,468 ops/sec ±0.40% (194 runs sampled)\n  nativeurl x     99,437 ops/sec ±0.71% (194 runs sampled)\n  parseurl  x 10,498,005 ops/sec ±0.61% (186 runs sampled)\n\n> node benchmark/simplepath.js\n\n  Parsing URL \"/foo/bar\"\n\n  1 test completed.\n  2 tests completed.\n  3 tests completed.\n\n  fasturl   x 4,535,825 ops/sec ±0.27% (191 runs sampled)\n  nativeurl x    98,769 ops/sec ±0.54% (191 runs sampled)\n  parseurl  x 4,164,865 ops/sec ±0.34% (192 runs sampled)\n\n> node benchmark/slash.js\n\n  Parsing URL \"/\"\n\n  1 test completed.\n  2 tests completed.\n  3 tests completed.\n\n  fasturl   x 4,908,405 ops/sec ±0.42% (191 runs sampled)\n  nativeurl x   100,945 ops/sec ±0.59% (188 runs sampled)\n  parseurl  x 4,333,208 ops/sec ±0.27% (194 runs sampled)\n```\n\n## License\n\n  [MIT](LICENSE)\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/expressjs/parseurl/issues"},"homepage":"https://github.com/expressjs/parseurl","_id":"parseurl@1.3.0","_shasum":"b58046db4223e145afa76009e61bac87cc2281b3","_from":"https://registry.npmjs.org/parseurl/-/parseurl-1.3.0.tgz","_resolved":"https://registry.npmjs.org/parseurl/-/parseurl-1.3.0.tgz"}