unshiftio / url-parse

Small footprint URL parser that works seamlessly across Node.js and browser environments.
http://unshift.io
MIT License
1.03k stars 103 forks source link

searchParams is not available (though query is) #162

Open prabashn opened 5 years ago

prabashn commented 5 years ago

Per Mozilla docs, searchParams should contain the parsed query params. https://developer.mozilla.org/en-US/docs/Web/API/URL/searchParams.

But url-parse does not support this.

lpinca commented 5 years ago

This module was conceived to be compatible with the legacy Node.js URL parser: https://nodejs.org/api/url.html#url_legacy_urlobject.

> url.parse('http://example.com/?foo=bar', true)
Url {
  protocol: 'http:',
  slashes: true,
  auth: null,
  host: 'example.com',
  port: null,
  hostname: 'example.com',
  hash: null,
  search: '?foo=bar',
  query: { foo: 'bar' },
  pathname: '/',
  path: '/?foo=bar',
  href: 'http://example.com/?foo=bar' }
worc commented 4 years ago

an alias here would make a lot of sense. it's a module that can be used in the front end.