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

refactor: add some improvements #118

Merged
merged 3 commits into from
Sep 4, 2018
Merged

refactor: add some improvements #118

merged 3 commits into from
Sep 4, 2018

Conversation

Beraliv
Copy link
Contributor

@Beraliv Beraliv commented Sep 3, 2018

  • replace unused variable with _
  • throw stops running the code in a function, so don't need to use else then
  • ||-operator is working wrong when falsy values go, so better replace them with !=-operator (as it's not strict and only undefined and null are usable there)
  • better put conditions out of for loop to not evaluating them over and over for no need
  • +0.0 and 0.0 are exactly same values
  • [].slice is shorter than Array.prototype.slice. Moreover, it converts arguments to an array from the beginning (index 0) by default, so you don't need to set it manually
  • sometimes saving values to variables can take more time, it might be ambiguous
  • Math.max and Math.min work longer than your own implementation
  • check function can take any values now with Number.isFinite

* replace unused variable with `_`
* `throw` stops running the code in a function, so don't need to use `else` then
* `||`-operator is working wrong when falsy values go, so better replace them with `!=`-operator (as it's not strict and only `undefined` and `null` are usable there)
* better put conditions out of `for` loop to not evaluating the condition over and over for no need
* `+0.0` and `0.0` are exactly same values
* `[].slice` is shorter than `Array.prototype.slice`
* sometimes saving values to an arguments can take more time, it might be ambiguous
* `Math.max` and `Math.min` work longer than your own implementation
* `check` function can take `any` values now with `Number.isFinite`
*
@Beraliv
Copy link
Contributor Author

Beraliv commented Sep 3, 2018

@mateogianolio please have a look at it

The PR fixes Issue#113 about deviation and mean default values

@mateogianolio
Copy link
Owner

Hey @Beraliv! Looks great, I’m on my phone right now so I'll have a look at it and merge tomorrow. Thank you so much for your contribution!

@Beraliv
Copy link
Contributor Author

Beraliv commented Sep 4, 2018

There are some problems with nyc
Have a look at it, @mateogianolio

@mateogianolio
Copy link
Owner

Seems like nyc requires node >= 6. I updated node version in travis to 6.9.0, let's see if it works.

@mateogianolio
Copy link
Owner

Yep, that was it! Great job 👍

@mateogianolio mateogianolio merged commit 6516382 into mateogianolio:master Sep 4, 2018
@Beraliv Beraliv deleted the refactor/general branch September 4, 2018 21:43
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