is-node-modern
Detects if node is modern, with helpful command line tools
Install
npm install --save-dev is-node-modern
then add to your package.json
following script:
"scripts":
By default it will consider modern node versions that equal or above LTS version.
Also you can specify custom threshold, like:
"scripts":
to execute provided commands within custom threshold.
Example
CLI
Running eslint
in node version equal or above 4 (current LTS version):
"scripts":
Now you can have CI for node versions below 4
, while running latest eslint only within node@4+
.
Node
Also, it could be used as regular node module:
var isNodeModern = ; if // only run in node@4+ if // only run in node@6+
License
Is-Node-Modern is released under the MIT license.