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

#831 Update node version check to support node 10 #832

Closed
wants to merge 1 commit into from
Closed

#831 Update node version check to support node 10 #832

wants to merge 1 commit into from

Conversation

mattridley
Copy link

@mattridley mattridley commented Apr 25, 2018

Update the node version check to support node 10 (#831). The current check fails once the node version hits double figures.

This PR simplifies the check to only compare the major version number.

@mattridley mattridley changed the title Update node version check to support node 10 #831 Update node version check to support node 10 Apr 25, 2018
@codecov
Copy link

codecov bot commented Apr 25, 2018

Codecov Report

Merging #832 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #832   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          12     12           
  Lines         621    621           
=====================================
  Hits          621    621

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2155cab...a9b1675. Read the comment docs.

var nodeVersionInfo = process.versions.node.split('.').map(function (n) { return Number(n) })
if (nodeVersionInfo < [4, 0, 0]) {
var nodeMajorVersion = Number(process.versions.node.split('.')[0])
if (nodeMajorVersion < 4) {
Copy link
Contributor

Choose a reason for hiding this comment

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

If you want to check if the version is greater than some specific semver in the future, I would require semver and use its comparison method... inequality checks on arrays convert to strings ... so [4,2,0] > [4,10,0] == true but should be false when comparing two versions.

But, if all this cares about is the major version, then this approach is sufficient.

@chhh
Copy link

chhh commented May 2, 2018

There's already another PR with semver: #835
Please somebody accept it!

@malept malept closed this in #835 May 3, 2018
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.

None yet

3 participants