Permalink
Browse files

Initial commit 0.1.0

  • Loading branch information...
0 parents commit 98e15653972ccf2332fd5ed03dd40086b26b5bcf @srod committed Aug 12, 2011
Showing with 83 additions and 0 deletions.
  1. +3 −0 .gitignore
  2. +3 −0 .npmignore
  3. +28 −0 Readme.md
  4. +3 −0 examples/server.js
  5. +1 −0 index.js
  6. +25 −0 lib/node-version.js
  7. +20 −0 package.json
@@ -0,0 +1,3 @@
+.svn
+.idea
+._*
@@ -0,0 +1,3 @@
+.svn
+.idea
+._*
@@ -0,0 +1,28 @@
+
+# Node-version
+
+ A quick module that returns current node version.
+
+ See server.js in examples/
+
+## Installation
+
+ npm install node-version
+
+## Quick Start
+
+ var nodeVersion = new (require('../lib/node-version').version);
+ var currentVersion = nodeVersion.getVersion();
+
+ /*
+ console.log(currentVersion);
+
+ {
+ original: 'v0.4.10', // same as process.version
+ short: '0.4',
+ long: '0.4.10',
+ major: '0',
+ minor: '4',
+ build: '10'
+ }
+ */
@@ -0,0 +1,3 @@
+var nodeVersion = new (require('../lib/node-version').version);
+
+console.log(nodeVersion.getVersion());
@@ -0,0 +1 @@
+module.exports = require('./lib/node-version');
@@ -0,0 +1,25 @@
+var version = function() {
+
+};
+
+version.prototype.getVersion = 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]
+ };
+};
+
+exports.version = '0.1.0';
+exports.version = version;
@@ -0,0 +1,20 @@
+{
+ "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"]
+}

0 comments on commit 98e1565

Please sign in to comment.