
package.index.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of parse-node-version Show documentation
Show all versions of parse-node-version Show documentation
Turn node's process.version into something useful.
The newest version!
'use strict';
function parseNodeVersion(version) {
var match = version.match(/^v(\d{1,2})\.(\d{1,2})\.(\d{1,2})(?:-([0-9A-Za-z-.]+))?(?:\+([0-9A-Za-z-.]+))?$/); // eslint-disable-line max-len
if (!match) {
throw new Error('Unable to parse: ' + version);
}
var res = {
major: parseInt(match[1], 10),
minor: parseInt(match[2], 10),
patch: parseInt(match[3], 10),
pre: match[4] || '',
build: match[5] || '',
};
return res;
}
module.exports = parseNodeVersion;
© 2015 - 2025 Weber Informatics LLC | Privacy Policy