srod / node-version

Get Node current version

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Simplify Logic

madhavarshney opened this issue · comments

Hi there! I looked through the code and found that it can be a little simplified. The snippet below can be replaced by a simple process.versions.node:

node-version/index.js

Lines 8 to 12 in 4efd69f

var version = process.version;
if (version.indexOf('v') > -1) {
version = version.split('v')[1];
}

var version = process.versions.node;

And this can be replaced with long: version:

long: split[0] + '.' + split[1] + '.' + split[2],

If you don't mind, I can open a PR.

Thanks, Madhav.

Hi,

Yes, PR welcome 👍

Thank you !