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

Fixed bug whereby absoluteTo failed on a root base #200

Merged
merged 1 commit into from
Mar 31, 2015

Conversation

giltayar
Copy link
Contributor

E.g. URI("tofile").absoluteTo("/file") should return "/tofile" but didn't.
Added test case

    E.g. URI("tofile").absoluteTo("/file") should return "/tofile" but didn't.
    Added test case
@@ -1863,6 +1863,7 @@

if (resolved.path().charAt(0) !== '/') {
basedir = base.directory();
basedir = basedir ? basedir : base.path().indexOf('/') === 0 ? '/' : '';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that reads horribly (not that my code reads any better…)
wondering if the following makes more sense

// either basedir is a thing, or path begins with /, defaults to empty string
basedir || base.path().slice(0, 1) === '/' && '/' || '';

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I know. It somehow seems that there should be a cleaner way to do this... :-) But I couldn't find it (admittedly,

As for changing the ?: to ||&& - that's a question of style. My code is more "say what you mean", yours is more concise. I could go either way.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah… this is personal preference, I agree.
since most of the code is using ternaries rather than "truthy-switches" (whatever they're called), I'd roll with your solution for now.

rodneyrehm added a commit that referenced this pull request Mar 31, 2015
Fixed bug whereby absoluteTo failed on a root base
@rodneyrehm rodneyrehm merged commit 20d6b72 into medialize:master Mar 31, 2015
@rodneyrehm
Copy link
Member

released v1.15.0, thank you for your support!

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

Successfully merging this pull request may close these issues.

None yet

2 participants