fjorgemota / jimple

Just a dependency injection container to NodeJS and to the browser using new ES6 features
MIT License
75 stars 12 forks source link

More readable get function. #51

Open tothimre-zz opened 5 years ago

tothimre-zz commented 5 years ago

The code is easier to read, for further contribution.

fjorgemota commented 5 years ago

Hey.

Sorry for the slow response, I'm quite busy with another project and didn't saw this pull request.

I was reading the changes you made here and they look quite...redundant, I mean, you're avoiding totally the use of else blocks (which are quite readable already in my opinion) and adding a lot of redundant checks that just don't feel....right (I mean, they are exactly what the else blocks already check itself, and in your code it is totally unnecessary).

Just to mention an example, if isItProtected is true, you already return the item just when it enters the if block in line 68, so you don't need to check again if isItProtected is false (by using !isItProtected, obviously) in the lines below because it is already obviously false.

Right now, I don't see a good reason to accept this pull request. I could say that you can just avoid a lot of if and else blocks by doing something similar to Pimple's get implementation, which does a lot of checks on the first if and doesn't use else blocks too..So feel free to update your approach if you want.

Anyway, thanks for the pull request, and I hope the review is good enough for you and that I explained the point well.