source: trip-planner-front/node_modules/parse-node-version/index.js@ 571e0df

Last change on this file since 571e0df was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 497 bytes
Line 
1'use strict';
2
3function parseNodeVersion(version) {
4 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
5 if (!match) {
6 throw new Error('Unable to parse: ' + version);
7 }
8
9 var res = {
10 major: parseInt(match[1], 10),
11 minor: parseInt(match[2], 10),
12 patch: parseInt(match[3], 10),
13 pre: match[4] || '',
14 build: match[5] || '',
15 };
16
17 return res;
18}
19
20module.exports = parseNodeVersion;
Note: See TracBrowser for help on using the repository browser.