UNPKG

@instana/core

Version:
29 lines (25 loc) 893 B
/* * (c) Copyright IBM Corp. 2022 */ 'use strict'; /** * This is the minimum required Node.js version for all @instana packages. */ exports.minimumNodeJsVersion = 18; /** * Checks if the value of process.version denotes a Node.js version that is not supported, that is, older than the given * minimum version. * * @returns {boolean} true, if and only if process.version can be parsed and is older than minimumNodeJsVersion */ exports.isNodeJsTooOld = function isNodeJsTooOld() { const currentVersion = process.version; if (typeof currentVersion === 'string') { const majorVersionStr = process.version.split('.')[0]; if (majorVersionStr.length > 1 && majorVersionStr.charAt(0) === 'v') { const majorVersion = parseInt(majorVersionStr.substring(1), 10); return !isNaN(majorVersion) && majorVersion < exports.minimumNodeJsVersion; } } return false; };