Skip to content

Commit

Permalink
NPM enforces the field for "engines" in package.json at install time,…
Browse files Browse the repository at this point in the history
… so there should not be any need for boilerplate code for checking the version of node.
  • Loading branch information
tedeh committed Oct 23, 2011
1 parent 5ebf7ee commit 63dcc87
Showing 1 changed file with 2 additions and 32 deletions.
34 changes: 2 additions & 32 deletions lib/ya-csv.js
@@ -1,9 +1,5 @@
var sys = require('sys');

var REQUIRED_NODE_VERSION = '0.1.99';
_checkVersionNumber();

var events = require('events'),
var sys = require('sys'),
events = require('events'),
fs = require('fs');

var csv = exports;
Expand Down Expand Up @@ -268,29 +264,3 @@ function _setOptions(obj, options) {
obj.columnsFromHeader = options.columnsFromHeader || false;
obj.nestedQuotes = options.nestedQuotes || false;
};

function _checkVersionNumber() {
var supported = (function() {
if (!process.version) return false;
function version2fields(v) {
var fields = v.split('.');
return [ parseInt(fields[0]), parseInt(fields[1]), parseInt(fields[2]) ];
}
var r = version2fields(REQUIRED_NODE_VERSION);
var a = version2fields(process.version.replace(/^v/, ''));
if (a[0] > r[0]) {
return true;
} else if (a[0] === r[0]) {
if (a[1] > r[1]) {
return true;
} else if (a[1] === r[1]) {
if (a[2] >= r[2]) return true;
}
}
return false;
})();
if (! supported) {
sys.debug("Unsupported Node.js version: expected "
+ REQUIRED_NODE_VERSION + " or higher, got " + process.version);
}
};

0 comments on commit 63dcc87

Please sign in to comment.