Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An exception is thrown when using URI() without the new keyword #205

Closed
KyleNeedham opened this issue Apr 1, 2015 · 3 comments
Closed
Labels

Comments

@KyleNeedham
Copy link

When URI is used without the new keyword it will return a new instance of itself passing both an url and base parameter.

if (!(this instanceof URI)) {
  return new URI(url, base);
}

Since these parameters are both undefined at this point, it is caught by the undefined check on the url and then also passes the check on the arguments length, throwing a TypeError.

if (url === undefined) {
  if (arguments.length) {
    throw new TypeError('undefined is not a valid argument for URI');
  }
@rodneyrehm
Copy link
Member

I can reproduce the issue.

@rodneyrehm
Copy link
Member

fixed in master. can you wait for 1.15.1 a bit?

@KyleNeedham
Copy link
Author

Yeah sure that's fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants