node-version
Advanced tools
Comparing version 0.1.0 to 1.0.0
19
index.js
@@ -1,1 +0,18 @@ | ||
module.exports = require('./lib/node-version'); | ||
module.exports = (function() { | ||
var version = process.version; | ||
if (version.indexOf('v') > -1) { | ||
version = version.split('v')[1]; | ||
} | ||
var split = version.split('.'); | ||
return { | ||
original: process.version, | ||
short: split[0] + '.' + split[1], | ||
long: split[0] + '.' + split[1] + '.' + split[2], | ||
major: split[0], | ||
minor: split[1], | ||
build: split[2] | ||
}; | ||
})(); |
{ | ||
"name": "node-version", | ||
"version": "0.1.0", | ||
"description": "Get NodeJS current version", | ||
"homepage": "https://github.com/srod/node-version", | ||
"author": { | ||
"name": "Rodolphe Stoclin", | ||
"email": "rodolphe@2clics.net", | ||
"url": "http://2clics.net" | ||
}, | ||
"main": "index", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/srod/node-version.git" | ||
}, | ||
"keywords": ["version"] | ||
"name": "node-version", | ||
"version": "1.0.0", | ||
"description": "Get NodeJS current version", | ||
"homepage": "https://github.com/srod/node-version", | ||
"author": { | ||
"name": "Rodolphe Stoclin", | ||
"email": "rodolphe@2clics.net", | ||
"url": "http://2clics.net" | ||
}, | ||
"main": "./index.js", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/srod/node-version.git" | ||
}, | ||
"keywords": [ | ||
"version" | ||
], | ||
"devDependencies": { | ||
"semver": "^5.0.1" | ||
} | ||
} |
@@ -0,28 +1,48 @@ | ||
[![Dependency Status](http://img.shields.io/david/srod/node-version.svg?style=flat)](https://david-dm.org/srod/node-version) | ||
[![devDependency Status](http://img.shields.io/david/dev/srod/node-version.svg?style=flat)](https://david-dm.org/srod/node-version#info=devDependencies) | ||
[![NPM version](http://img.shields.io/npm/v/node-version.svg?style=flat)](https://www.npmjs.org/package/node-version) | ||
# Node-version | ||
A quick module that returns current node version. | ||
See server.js in examples/ | ||
A quick module that returns current node version parsed into parts. | ||
## Installation | ||
npm install node-version | ||
```shell | ||
npm install node-version | ||
``` | ||
## Quick Start | ||
var nodeVersion = new (require('../lib/node-version').version); | ||
var currentVersion = nodeVersion.getVersion(); | ||
```js | ||
var currentVersion = require('node-version'); | ||
/* | ||
console.log(currentVersion); | ||
/* | ||
console.log(currentVersion); | ||
{ | ||
original: 'v0.4.10', // same as process.version | ||
short: '0.4', | ||
long: '0.4.10', | ||
major: '0', | ||
minor: '4', | ||
build: '10' | ||
} | ||
*/ | ||
{ | ||
original: 'v0.4.10', // same as process.version | ||
short: '0.4', | ||
long: '0.4.10', | ||
major: '0', | ||
minor: '4', | ||
build: '10' | ||
} | ||
*/ | ||
``` | ||
## Warning | ||
Version 1.0.0 break 0.1.0 since its API changes. | ||
Change | ||
```js | ||
var currentVersion = new (require('../lib/node-version').version); | ||
``` | ||
To | ||
```js | ||
var currentVersion = require('node-version'); | ||
``` |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
0
49
0
2513
1
5
15
1