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

Update dependencies. Update codebase to ES6/Node4 #51

Closed
wants to merge 3 commits into from

Conversation

@escalant3
Copy link
Contributor

escalant3 commented Dec 16, 2015

I have been exploring the Hapi codebase recently and I noticed inert was not ES6 ready. This PR should comply with all the requirements specified in #49

The linter was complaining about lots of things that were fixed:

  • No double assignments in loops.
  • Array functions everywhere (except a test that access arguments, too bad the rest operator is not available).
  • use strict and const always that it's possible.let only in mutable cases
  • package.json dependencies matching those in hapi/package.json
  • else should not be in the same line where the previous if closes
  • All tests passing. Test coverage 100%

Questions:

  • I guess that bumping to node 4.x is a breaking change so the version should be 4.0.0. But I am not sure how the Hapi team deals with versions.
  • I didn't change the +=. I could do it if needed.

Thanks for such an awesome framework. I hope this helps.

Cheers!

var path = paths[i];
const normalized = [];
const il = paths.length;
for (let i = 0; i < il; ++i) {

This comment has been minimized.

Copy link
@Marsup

Marsup Dec 16, 2015

Member

We're also not memoizing the length anymore unless necessary.

var hasTrailingSlash = (resource[resource.length - 1] === '/');
var fileOptions = { lookupCompressed: settings.lookupCompressed, etagMethod: settings.etagMethod };
const resource = request.path;
const hasTrailingSlash = (resource[resource.length - 1] === '/');

This comment has been minimized.

Copy link
@Marsup

Marsup Dec 16, 2015

Member

Maybe we can use resource.endsWith('/') for that, @cjihrig @kpdecker any clue about performance on this ?

This comment has been minimized.

Copy link
@escalant3

escalant3 Dec 17, 2015

Author Contributor

I think endsWith is more readable. I'll change it back if needed.

This comment has been minimized.

Copy link
@cjihrig

cjihrig Dec 17, 2015

+1 to going for readability.

html += '<li><a href="' + internals.pathEncode(parent) + '">Parent Directory</a></li>';
}

for (var i = 0, il = files.length; i < il; ++i) {
const il = files.length;
for (let i = 0; i < il; ++i) {

This comment has been minimized.

Copy link
@Marsup

Marsup Dec 16, 2015

Member

Same for length here.

@kanongil kanongil modified the milestone: 4.0.0 Dec 22, 2015
@kanongil kanongil added the feature label Dec 22, 2015
@kanongil kanongil self-assigned this Dec 22, 2015
@kanongil

This comment has been minimized.

Copy link
Member

kanongil commented Dec 22, 2015

Thanks – merged in cbab9fc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.