Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

url_grey

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

url_grey

  • 1.0.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

URLGrey

This attempts to copy chomium's algorithm for making sense of things typed into the url bar. You can download the chromium source to play along, but note that it is currently 2.1 GB.

The ported code is very similar to how it is written in the original C++. It is a great example of the imperative style of programming by state mutation. I'm not gonna lie, it's pretty gross. But hey, it passes the tests.

Usage

Some examples from the tests:

URLGrey.new("google.com").fixed
#=> "http://google.com/"

URLGrey.new("www.google.com#foo").fixed
#=> "http://www.google.com/#foo"

URLGrey.new("\u6C34.com").fixed
#=> "http://xn--1rw.com/"

URLGrey.new("http://foo.com/s?q=\uC5C5").fixed
#=> "http://foo.com/s?q=%EC%97%85"

URLGrey.new("http;/www.google.com/").fixed
#=> "http://www.google.com/"

URLGrey.new(" foo.com/asdf  bar").fixed
#=> "http://foo.com/asdf%20%20bar"

URLGrey.new("[::]:80/path").fixed
#=> "http://[::]/path"

FAQs

Package last updated on 17 Feb 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc