forked from DataDog/dd-trace-js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathversion.js
More file actions
20 lines (17 loc) · 677 Bytes
/
Copy pathversion.js
File metadata and controls
20 lines (17 loc) · 677 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
'use strict'
/** @typedef {NonNullable<ReturnType<string['match']>>} RegExpMatch */
var version = require('./package.json').version
// @ts-expect-error
var /** @type {RegExpMatch} */ ddMatches = version.match(/^(\d+)\.(\d+)\.(\d+)/)
// @ts-expect-error
var /** @type {RegExpMatch} */ nodeMatches = process.versions.node.match(/^(\d+)\.(\d+)\.(\d+)/)
module.exports = {
VERSION: version,
DD_MAJOR: parseInt(ddMatches[1], 10),
DD_MINOR: parseInt(ddMatches[2], 10),
DD_PATCH: parseInt(ddMatches[3], 10),
NODE_MAJOR: parseInt(nodeMatches[1], 10),
NODE_MINOR: parseInt(nodeMatches[2], 10),
NODE_PATCH: parseInt(nodeMatches[3], 10),
NODE_VERSION: nodeMatches[0]
}