-
Notifications
You must be signed in to change notification settings - Fork 475
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
Add an origin function #263
Conversation
The origin consists of only the scheme and authority. This change adds the following ways to work with the origin: URI.buildOrigin(parts); u.origin() u.origin(uri)
if (v === undefined) { | ||
return this._parts.hostname ? URI.buildOrigin(this._parts) : ''; | ||
} else { | ||
parts = URI.parse(v); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I would have used the existing accessory here as well:
var origin = URI(v);
this
.protocol(origin.protocol())
.authority(origin.authority())
.build(!build);
return this;
While simpler to read, it is slower because of double parsing…
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so that's better, even with double parsing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed it to do this despite double building. Easier to read.
In |
I updated the e.g.
|
I added some stuff to docs.html. I'll look at the other one now. |
Fixed doco verbage based on your last comment. |
feature(origin) adding origin() accessor
thank you very much :) |
Thank you! We look forward to getting it in an update. |
I'll try to make that happen tomorrow… |
released in v1.17.0 |
The origin consists of only the scheme and authority. This change adds the following ways to work with the origin:
Ascii art screenshot:
![screen shot 2015-11-12 at 2 11 12 pm](https://cloud.githubusercontent.com/assets/10974/11129866/6614d066-8947-11e5-8922-a648e3ee81bc.png)