parseurl

WebJar for parseurl

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

parseurl
Last Version

Last Version

1.3.3
Release Date

Release Date

Type

Type

jar
Description

Description

parseurl
WebJar for parseurl
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/pillarjs/parseurl

Download parseurl

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/parseurl/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>parseurl</artifactId>
    <version>1.3.3</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/parseurl/
implementation 'org.webjars.npm:parseurl:1.3.3'
// https://jarcasting.com/artifacts/org.webjars.npm/parseurl/
implementation ("org.webjars.npm:parseurl:1.3.3")
'org.webjars.npm:parseurl:jar:1.3.3'
<dependency org="org.webjars.npm" name="parseurl" rev="1.3.3">
  <artifact name="parseurl" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='parseurl', version='1.3.3')
)
libraryDependencies += "org.webjars.npm" % "parseurl" % "1.3.3"
[org.webjars.npm/parseurl "1.3.3"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

parseurl

NPM Version NPM Downloads Node.js Version Build Status Test Coverage

Parse a URL with memoization.

Install

This is a Node.js module available through the npm registry. Installation is done using the npm install command:

$ npm install parseurl

API

var parseurl = require('parseurl')

parseurl(req)

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.

parseurl.original(req)

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.

Benchmark

$ npm run-script bench

> [email protected] bench nodejs-parseurl
> node benchmark/index.js

  [email protected]
  [email protected]
  [email protected]
  [email protected]
  [email protected]
  [email protected]
  modules@64
  [email protected]
  napi@3
  [email protected]
  [email protected]
  [email protected]
  [email protected]
  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)
  nativeurl - legacy x   507,180 ops/sec ±0.82% (191 runs sampled)
  nativeurl - whatwg x   290,044 ops/sec ±1.96% (189 runs sampled)
  parseurl           x   488,907 ops/sec ±2.13% (192 runs sampled)

> node benchmark/pathquery.js

  Parsing URL "/foo/bar?user=tj&pet=fluffy"

  4 tests completed.

  fasturl            x 3,812,564 ops/sec ±3.15% (188 runs sampled)
  nativeurl - legacy x 2,651,631 ops/sec ±1.68% (189 runs sampled)
  nativeurl - whatwg x   161,837 ops/sec ±2.26% (189 runs sampled)
  parseurl           x 4,166,338 ops/sec ±2.23% (184 runs sampled)

> node benchmark/samerequest.js

  Parsing URL "/foo/bar?user=tj&pet=fluffy" on same request object

  4 tests completed.

  fasturl            x  3,821,651 ops/sec ±2.42% (185 runs sampled)
  nativeurl - legacy x  2,651,162 ops/sec ±1.90% (187 runs sampled)
  nativeurl - whatwg x    175,166 ops/sec ±1.44% (188 runs sampled)
  parseurl           x 14,912,606 ops/sec ±3.59% (183 runs sampled)

> node benchmark/simplepath.js

  Parsing URL "/foo/bar"

  4 tests completed.

  fasturl            x 12,421,765 ops/sec ±2.04% (191 runs sampled)
  nativeurl - legacy x  7,546,036 ops/sec ±1.41% (188 runs sampled)
  nativeurl - whatwg x    198,843 ops/sec ±1.83% (189 runs sampled)
  parseurl           x 24,244,006 ops/sec ±0.51% (194 runs sampled)

> node benchmark/slash.js

  Parsing URL "/"

  4 tests completed.

  fasturl            x 17,159,456 ops/sec ±3.25% (188 runs sampled)
  nativeurl - legacy x 11,635,097 ops/sec ±3.79% (184 runs sampled)
  nativeurl - whatwg x    240,693 ops/sec ±0.83% (189 runs sampled)
  parseurl           x 42,279,067 ops/sec ±0.55% (190 runs sampled)

License

MIT

org.webjars.npm
The BYO HTTP Framework Framework

Versions

Version
1.3.3
1.3.2
1.3.1
1.3.0