package
parse a url with memoization
npm install parseurlGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Estimated unpacked size across 1 packages.
10.1 kB
Includes dependencies.
Parse a URL with memoization.
This is a Node.js module available through the
npm registry. Installation is done using the
npm install command:
$ npm install parseurlvar parseurl = require('parseurl')Parse the URL of the given request object (looks at the req.url property)
and return the result. The result is the same as url.parse in Node.js core.
Calling this function multiple times on the same req where req.url does
not change will return a cached parsed object, rather than parsing again.
Parse the original URL of the given request object and return the result.
This works by trying to parse req.originalUrl if it is a string, otherwise
parses req.url. The result is the same as url.parse in Node.js core.
Calling this function multiple times on the same req where req.originalUrl
does not change will return a cached parsed object, rather than parsing again.
$ npm run-script bench
> parseurl@1.3.3 bench nodejs-parseurl
> node benchmark/index.js
http_parser@2.8.0
node@10.6.0
v8@6.7.288.46-node.13
uv@1.21.0
zlib@1.2.11
ares@1.14.0
modules@64
nghttp2@1.32.0
napi@3
openssl@1.1.0h
icu@61.1
unicode@10.0
cldr@33.0
tz@2018c
> node benchmark/fullurl.js
Parsing URL "http://localhost:8888/foo/bar?user=tj&pet=fluffy"
4 tests completed.
fasturl x 2,207,842 ops/sec ±3.76% (184 runs sampled)
blakeembrey
hello@blakeembrey.com