ProductPromotion
Logo

Java.Script

made by https://0x3d.site

GitHub - anonrig/url-js: Super fast spec-compliant URL state machine for Node.js
Super fast spec-compliant URL state machine for Node.js - anonrig/url-js
Visit Site

GitHub - anonrig/url-js: Super fast spec-compliant URL state machine for Node.js

GitHub - anonrig/url-js: Super fast spec-compliant URL state machine for Node.js

URL State Machine

Super fast specification compliant URL state machine for Node.js. For more information about the URL parsing state machine visit here.

Installation

npm i --save url-state-machine

Usage

const URLStateMachine = require('url-state-machine')
const state = new URLStateMachine('https://www.yagiz.co/implementing-node-js-url-parser-in-webassembly-with-rust')

console.log(state.url)
// {
//   scheme: 'https',
//   username: '',
//   password: '',
//   host: 'www.yagiz.co',
//   port: null,
//   path: [ 'implementing-node-js-url-parser-in-webassembly-with-rust' ],
//   query: null,
//   fragment: null
// }

Benchmarks

  • new URL("/path/to/something?hello=world", "https://www.google.com")
╔═══════════════════╤═════════╤══════════════════╤═══════════╤══════════════════════════╗
║ Slower tests      │ Samples │           Result │ Tolerance │ Difference with previous ║
╟───────────────────┼─────────┼──────────────────┼───────────┼──────────────────────────╢
║ whatwg-url        │    1000 │  37994.48 op/sec │  ± 0.97 % │                          ║
║ url-state-machine │    9500 │ 257195.34 op/sec │  ± 0.99 % │ + 576.93 %               ║
╟───────────────────┼─────────┼──────────────────┼───────────┼──────────────────────────╢
║ Fastest test      │ Samples │           Result │ Tolerance │ Difference with previous ║
╟───────────────────┼─────────┼──────────────────┼───────────┼──────────────────────────╢
║ URL               │   10000 │ 477303.34 op/sec │  ± 1.27 % │ + 85.58 %                ║
╚═══════════════════╧═════════╧══════════════════╧═══════════╧══════════════════════════╝
  • new URL("http://127.0.0.1")
╔═══════════════════╤═════════╤═══════════════════╤═══════════╤══════════════════════════╗
║ Slower tests      │ Samples │            Result │ Tolerance │ Difference with previous ║
╟───────────────────┼─────────┼───────────────────┼───────────┼──────────────────────────╢
║ whatwg-url        │    5000 │   91747.56 op/sec │  ± 0.97 % │                          ║
║ url-state-machine │   10000 │  626208.74 op/sec │  ± 1.65 % │ + 582.53 %               ║
╟───────────────────┼─────────┼───────────────────┼───────────┼──────────────────────────╢
║ Fastest test      │ Samples │            Result │ Tolerance │ Difference with previous ║
╟───────────────────┼─────────┼───────────────────┼───────────┼──────────────────────────╢
║ URL               │    2500 │ 1037903.40 op/sec │  ± 0.87 % │ + 65.74 %                ║
╚═══════════════════╧═════════╧═══════════════════╧═══════════╧══════════════════════════╝
  • new URL("http://[1:0::]")
╔═══════════════════╤═════════╤═══════════════════╤═══════════╤══════════════════════════╗
║ Slower tests      │ Samples │            Result │ Tolerance │ Difference with previous ║
╟───────────────────┼─────────┼───────────────────┼───────────┼──────────────────────────╢
║ whatwg-url        │    5500 │  196896.91 op/sec │  ± 0.97 % │                          ║
║ url-state-machine │   10000 │ 1321601.39 op/sec │  ± 2.76 % │ + 571.21 %               ║
╟───────────────────┼─────────┼───────────────────┼───────────┼──────────────────────────╢
║ Fastest test      │ Samples │            Result │ Tolerance │ Difference with previous ║
╟───────────────────┼─────────┼───────────────────┼───────────┼──────────────────────────╢
║ URL               │    8000 │ 1356561.74 op/sec │  ± 0.97 % │ + 2.65 %                 ║
╚═══════════════════╧═════════╧═══════════════════╧═══════════╧══════════════════════════╝

Testing

Running

All tests are referenced and borrowed from web-platform-tests.

npm test

Code Coverage

Test Files  1 failed (1)
     Tests  1 failed | 732 passed (733)
      Time  633ms (in thread 64ms, 989.58%)
File % Stmts % Branch % Funcs % Lines Uncovered Line #s
All files 95.88 95.18 98 95.88
constants.js 100 100 100 100
encoding.js 100 100 100 100
index.js 93.99 93.02 100 93.99 ...4-775,800-801,921-922,926-927,1070-1071
parser.js 99.53 99.05 100 99.53 283-284
platform.js 100 100 100 100
string.js 100 100 100 100
utf8.js 84.33 88.23 50 84.33 39-44,63-64,77-81

Conformance to specification

  • pathname
    • 1 failed | 732 passed (733)
  • search
    • 1 failed | 732 passed (733)
  • host
    • 733 passed (733)
  • password
    • 733 passed (733)
  • protocol
    • 733 passed (733)
  • username
    • 733 passed (733)
  • port
    • 733 passed (733)
  • fragment
    • 733 passed (733)

More Resources
to explore the angular.

mail [email protected] to add your project or resources here 🔥.

Related Articles
to learn about angular.

FAQ's
to learn more about Angular JS.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory