GithubHelp home page GithubHelp logo

fast-uri's People

Contributors

dependabot[bot] avatar eomm avatar fdawgs avatar is2ei avatar ivan-tymoshenko avatar mcollina avatar uzlopak avatar zekth avatar zhmushan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fast-uri's Issues

Encoding colon in the URL path

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the issue has not already been raised

Issue

I'm facing an error when replacing uri-js with fast-uri in ajv. I think it has to do with colon encoding.

'use strict';

const assert = require('assert')

const fastUri = require('fast-uri')
const uriJs = require('uri-js')

const data = {
  fragment: '/definitions/foo',
  path: 'to:local',
  reference: 'uri',
  scheme: 'relative',
}

assert.equal(
  fastUri.serialize(data), // 'relative:to%3Alocal#/definitions/foo'
  uriJs.serialize(data) // 'relative:to:local#/definitions/foo'
)

The original JSON schema is here: https://github.com/fastify/fast-json-stringify/blob/6ae2ae757f10f2491c0976bef44ff9fc4dd8f217/test/ref.test.js#L912

`new URL` is faster

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the issue has not already been raised

Issue

Since Ada, it seems like new URL's parsing is significantly faster

Maybe we can deprecate this package? The alternative would be to only keep url serialization since URL doesn't have an alternative, but I don't know how much it's used

What do you think?

ast-uri: parse domain x 1,199,118 ops/sec ±0.49% (98 runs sampled)
urijs: parse domain x 448,563 ops/sec ±0.10% (99 runs sampled)
WHATWG URL: parse domain x 2,581,665 ops/sec ±0.16% (97 runs sampled)
fast-uri: parse IPv4 x 1,785,608 ops/sec ±1.27% (95 runs sampled)
urijs: parse IPv4 x 370,294 ops/sec ±2.00% (97 runs sampled)
fast-uri: parse IPv6 x 832,663 ops/sec ±0.94% (98 runs sampled)
urijs: parse IPv6 x 280,835 ops/sec ±0.39% (100 runs sampled)
fast-uri: parse URN x 2,234,727 ops/sec ±0.62% (93 runs sampled)
urijs: parse URN x 1,118,988 ops/sec ±2.55% (94 runs sampled)
WHATWG URL: parse URN x 3,097,084 ops/sec ±0.15% (97 runs sampled)
fast-uri: parse URN uuid x 1,487,851 ops/sec ±0.09% (95 runs sampled)
urijs: parse URN uuid x 816,766 ops/sec ±0.09% (99 runs sampled)
fast-uri: serialize uri x 1,109,413 ops/sec ±0.39% (97 runs sampled)
urijs: serialize uri x 380,730 ops/sec ±0.36% (97 runs sampled)
fast-uri: serialize IPv6 x 365,499 ops/sec ±0.10% (100 runs sampled)

Add WHATWG URL to benchmarks

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the feature has not already been requested

🚀 Feature Proposal

Adding WHATWG URL to benchmarks might provide a useful comparison.

Motivation

No response

Example

No response

Support browser

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the feature has not already been requested

🚀 Feature Proposal

Are there plans to support browsers? It looks like it can be done with just any compiler tool.

Motivation

No response

Example

No response

encoding: review the flow

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the issue has not already been raised

Issue

As shown in #23
We need to review the encoding flow as during the migration process some spots might have been missed.

escape & unescape are deprecated

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the issue has not already been raised

Issue

IDE shows me warning: these functions are deprecated

Relative paths don't survive serialize/parse

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the bug has not already been reported

Fastify version

N/A

Plugin version

No response

Node.js version

16.0

Operating system

macOS

Operating system version (i.e. 20.04, 11.3, 10)

Mac

Description

Not sure it's a bug - is it intended? uri-js, annoyingly, does the same...

Steps to Reproduce

const uri = require('fast-uri')
let parsed = uri.parse('../one/two.three?q1=a1&q2=a2#body')
console.log(parsed)
console.log(uri.serialize(parsed))

// Output:
// {
// scheme : "uri",
// userinfo : "user:pass",
// host : "example.com",
// port : 123,
// path : "../one/two.three",
// query : "q1=a1&q2=a2",
// fragment : "body"
// }
//
// "one/two.three?q1=a1&q2=a2#body"

https://runkit.com/esp/6319bd9f5b03ac0008add460

Expected Behavior

No response

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.