Popularity
1.3
-
Activity
9.2
Declining
143
2
1

Description

Super fast specification compliant URL parser state machine for Node.js.

Programming language: JavaScript
License: MIT License
Tags: Editors     URL     JavaScript     Js    

URL Parser alternatives and similar libraries

Based on the "Editors" category.
Alternatively, view url-js alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of URL Parser or a related project?

Add another 'Editors' Library

README

URL Parser

This repository contains a work in progress state machine 100% compliant to the URL parser specification. The goal is to create a performant URL parser.

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)

Benchmarks

Here's the current benchmarks comparing url-state-machine with the native URL implementation and whatwg-url.

Even though these benchmarks provide a good reference for url-state-machine, should not be taken in any consideration since the implementation of url-state-machine is not finished, and does not reflect the final performance of it.

โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•คโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•คโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•คโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘ Slower tests      โ”‚ Samples โ”‚           Result โ”‚ Tolerance โ•‘
โ•Ÿโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ข
โ•‘ whatwg-url        โ”‚    1500 โ”‚  52643.30 op/sec โ”‚  ยฑ 0.85 % โ•‘
โ•‘ url-state-machine โ”‚    1500 โ”‚  60174.30 op/sec โ”‚  ยฑ 0.97 % โ•‘
โ•Ÿโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ข
โ•‘ Fastest test      โ”‚ Samples โ”‚           Result โ”‚ Tolerance โ•‘
โ•Ÿโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ข
โ•‘ URL               โ”‚   10000 โ”‚ 914694.49 op/sec โ”‚  ยฑ 2.42 % โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•งโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•งโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•งโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

Testing

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

Test Files  1 failed (1)
     Tests  189 failed | 544 passed (733)
      Time  76ms

Conformance to specification

We're currently testing only the following attributes for URL

  • pathname
    • 93 failed | 640 passed (733)
  • host
    • 72 failed | 661 passed (733)
  • password
    • 2 failed | 731 passed (733)
  • protocol
    • 1 failed | 732 passed (733)
  • username
    • 733 passed (733)
  • port
    • 733 passed (733)
  • fragment
    • 733 passed (733)
  • query
    • 733 passed (733)