Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version check for polyfills #253

Open
SemenchenkoVitaliy opened this issue Feb 13, 2019 · 2 comments
Open

Version check for polyfills #253

SemenchenkoVitaliy opened this issue Feb 13, 2019 · 2 comments

Comments

@SemenchenkoVitaliy
Copy link
Member

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

@nechaido
Copy link
Member

AFAIK we need to check that the current version is equal or higher than the specified version, not compatible.
Example: we only use mkdip polyfill for <10.12.0.

Version Polyfill v10.12.0 compatible
8.0.0 ✔️
10.0.0 ✔️
10.12.0 ✔️
11.0.0

@SemenchenkoVitaliy
Copy link
Member Author

@nechaido Agree, function name should be changed. What about verifyVersion or checkVersion? Can as well make compareVersions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants