question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

A parser for URL strings would be nice. Some possible examples:

$ echo "http://example.com/test/path?q1=foo&q2=bar#frag" | jc -p --url
{
  "scheme": "http",
  "host": "example.com",
  "path": ["test", "path"],
  "query": { "q1": "foo", "q2": "bar" },
  "fragment": "frag"
}
$ echo "http://john:pass@example.com" | jc -p --url
{ "scheme": "http", "host": "example.com", "user": "john", "password": "pass" }
$ echo "http://example.com:8080" | jc -p --url
{ "scheme": "http", "host": "example.com", "port": 8080 }

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:14 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
kellyjonbrazilcommented, Jul 18, 2022

I like that idea! I’ll look into it. Thanks for the suggestion!

0reactions
kellyjonbrazilcommented, Jul 23, 2022

This parser is now released in version 1.20.4.

BTW, this parser inspired me to also create:

  • ISO 8601 Datetime string parser
  • UNIX Epoch Timestamp string parser
  • JWT string parser
  • Email Address string parser
Read more comments on GitHub >

github_iconTop Results From Across the Web

Avoid "current URL string parser is deprecated" warning by ...
To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect. Doing this will cause the following error: TypeError: final ...
Read more >
url-parse - npm
Small footprint URL parser that works seamlessly across Node.js and browser environments. Latest version: 1.5.10, last published: 10 months ago.
Read more >
URL - Web APIs - MDN Web Docs - Mozilla
Chrome Edge URL Full support. Chrome32. more. Toggle history Full support. Edge12. Togg... URL() constructor Full support. Chrome19. Toggle history Full support. Edge12. footn... createObjectURL Full...
Read more >
URL | Node.js v19.3.0 Documentation
Creates a new URL object by parsing the input relative to the base . If base is passed as a string, it will...
Read more >
How to Parse URL in JavaScript: hostname, pathname, query ...
How to Parse URL in JavaScript: hostname, pathname, query, hash · const url = new URL(relativeOrAbsolute [, absoluteBase]); · const url = new...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found