Node Version

Node version.

Usage

var NODE_VERSION = require( '@stdlib/process/node-version' );

NODE_VERSION

Node version.

console.log( NODE_VERSION );
// => <string>

Notes

  • In browser environments and environments other than Node.js the Node version is equal to null.

Examples

var semver = require( 'semver' );
var NODE_VERSION = require( '@stdlib/process/node-version' );

if ( semver.lt( NODE_VERSION, '1.0.0' ) ) {
    console.log( 'Running on a pre-io.js version...' );
}
else if ( semver.lt( NODE_VERSION, '4.0.0' ) ) {
    console.log( 'Running on an io.js version...' );
}
else {
    console.log( 'Running on a post-io.js version...' );
}

CLI

Usage

Usage: node-version [options]

Options:

  -h,    --help                Print this message.
  -V,    --version             Print the package version.

Examples

$ node-version
<node_version>
Did you find this page helpful?