fastify / fast-uri Goto Github PK
View Code? Open in Web Editor NEWDependency free RFC 3986 URI toolbox
License: Other
Dependency free RFC 3986 URI toolbox
License: Other
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
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)
Adding WHATWG URL to benchmarks might provide a useful comparison.
No response
No response
Are there plans to support browsers? It looks like it can be done with just any compiler tool.
No response
No response
As shown in #23
We need to review the encoding flow as during the migration process some spots might have been missed.
IDE shows me warning: these functions are deprecated
N/A
No response
16.0
macOS
Mac
Not sure it's a bug - is it intended? uri-js, annoyingly, does the same...
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
No response
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.