ghostery / url-parser Goto Github PK
View Code? Open in Web Editor NEWA fast typescript implementation of the window.URL API
License: Mozilla Public License 2.0
A fast typescript implementation of the window.URL API
License: Mozilla Public License 2.0
The following URL is accepted by @cliqz/url-parser
but rejected by URL
constructor in Firefox/Node.js: http://data:text/plain;charset=UTF-8;page=21,the%20data:1234,5678
.
Currently fails to handle ipv6 (e.g.: https://[::1]
).
For the following snippet,
let url = new URL('https://github.com');
url.searchParams.set('key', 'value');
console.log(url.href);
Standard URL
returns https://github.com/?key=value
while url-parser
gives me https://github.com
.
If this is out of the scope of this library (I guess is being a super fast parser), feel free to close the issue.
Currently the hostname is parsed using default tldts options. In practice we may want to pass options such as allowPrivateDomains
when parsing the hostname.
We could, for example, add an optional argument to the URL
constructor with the tldts IOptions
for tldts.parse
. Alternatively we could expose a global that sets the options for all URL
s created by the application.
There are a few resources we might be able to leverage to test more corner cases for the parsing logic.
In node/browser when native URL used the call like this new URL("webclient://domain.net/blank.html?loader-id=2fb1c580").origin
returns "null" (notice unknowns/custom scheme). This library returns the value regardless the scheme and I like such behavior.
The questions:
After installing the library I could see an exception because tslib
was missing. Probably it should be bundled instead.
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.