Skip to content

LDP constructor cleanup - #705

Merged
dmitrizagidulin merged 8 commits into
backend_refactorfrom
ldp-constructor-cleanup
Jun 14, 2018
Merged

dmitrizagidulin merged 8 commits into
backend_refactorfrom
ldp-constructor-cleanup

Conversation

@dmitrizagidulin

@dmitrizagidulin dmitrizagidulin commented Jun 11, 2018 •

Copy link
Copy Markdown
Contributor
  • Remove unused extend dep (obsoleted by Object.assign)
  • Extract initErrorPages() out of LDP constructor

(Part of ongoing PR #702)

@dmitrizagidulin
dmitrizagidulin force-pushed the ldp-constructor-cleanup branch from 008816d to 859cb0e Compare June 11, 2018 17:50
Comment thread lib/ldp.js
if (!this.root.endsWith('/')) { this.root += '/' }

if (this.corsProxy && !this.corsProxy.startsWith('/')) {
this.corsProxy = '/' + this.corsProxy

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

So the above is fine, but when I code, I tend to have the rule that the length of the code should represent the complexity of the action. My suggestion would be:

this.root.replace(/\/*$/, '/');
this.corsProxy.replace(/$\/*/, '/');

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Does the regex variant take care of the if (this.corsProxy && guard?

(I must admit, though I like the conciseness of regex, since i'm less familiar with it, I find the more wordy if/then more readable :) )

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ah no, doesn't have that guard. Leave it as-is then, readability is king.

@dmitrizagidulin
dmitrizagidulin merged commit 4d0d97c into backend_refactor Jun 14, 2018
@dmitrizagidulin
dmitrizagidulin deleted the ldp-constructor-cleanup branch June 14, 2018 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants