Skip to content

Version check for polyfills #253

@SemenchenkoVitaliy

Description

@SemenchenkoVitaliy

Sometimes we need to implement polyfills for older Node.js versions and for this we have to check version manually like:

const vArr = process.versions.node.split('.').map(num => parseInt(num));
if (vArr[0] > 8 || (vArr[0] === 8 && vArr[1] >= 2)) {
  ...
}

I propose to implement function that will check if process' version is older than required.

if (common.nodeVersionCompatible('8.2')) {
  ...
}

or

if (common.v8VersionCompatible('8.2')) {
  ...
}

WDYT?
/cc @lundibundi @nechaido @belochub @tshemsedinov

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions