Browse files

[fix] Changed require('sys') to require('util') for compatibility wit…

…h node v0.8
  • Loading branch information...
1 parent 8ab6026 commit 1400609299e0caa000d2e18f6c2221d2ecf7f5e9 @blakmatrix blakmatrix committed Jun 23, 2012
Showing with 17 additions and 17 deletions.
  1. +2 −2 bin/reshuffle.js
  2. +5 −5 test/echo.js
  3. +2 −2 test/index.js
  4. +8 −8 test/stream.js
View
4 bin/reshuffle.js
@@ -1,11 +1,11 @@
var csv = require('../lib/ya-csv'),
- sys = require('sys');
+ util = require('util');
var reader = csv.createCsvStreamReader(process.openStdin(), { columnsFromHeader: true });
var writer = csv.createCsvStreamWriter(process.stdout);
if (process.argv.length < 3) {
- sys.error("Usage: " + process.argv[0] + " " + process.argv[1] + " <output columns>");
+ util.error("Usage: " + process.argv[0] + " " + process.argv[1] + " <output columns>");
process.exit(1);
}
View
10 test/echo.js
@@ -1,10 +1,10 @@
var csv = require('../lib/ya-csv'),
- sys = require('sys');
+ util = require('util');
-sys.debug('start');
+util.debug('start');
if (process.argv.length < 3) {
- sys.error("Usage: node " + process.argv[1] + " <csv file>");
+ util.error("Usage: node " + process.argv[1] + " <csv file>");
process.exit(1);
}
@@ -23,8 +23,8 @@ var lines = 0;
var columns = 0;
csvIn.addListener('end', function() {
- sys.debug('end');
- sys.debug(columns + ' columns, ' + lines + ' lines');
+ util.debug('end');
+ util.debug(columns + ' columns, ' + lines + ' lines');
});
csvIn.addListener('data', function(data) {
View
4 test/index.js
@@ -2,7 +2,7 @@ var sys;
try {
sys = require('util');
} catch (e) {
- sys = require('sys');
+ util = require('util');
}
var csv = require('../lib/ya-csv'),
@@ -26,7 +26,7 @@ var columns = 0;
csvIn.addListener('end', function() {
assert.strictEqual(expectedRows, lines, "Wrong number of records");
- sys.debug(columns + ' columns, ' + lines + ' lines');
+ util.debug(columns + ' columns, ' + lines + ' lines');
});
csvIn.addListener('data', function(data) {
View
16 test/stream.js
@@ -1,11 +1,11 @@
var csv = require('../lib/ya-csv'),
- sys = require('sys'),
+ util = require('util'),
fs = require('fs');
-sys.debug('start');
+util.debug('start');
if (process.argv.length < 3) {
- sys.error("Usage: node " + process.argv[1] + " <csv file>");
+ util.error("Usage: node " + process.argv[1] + " <csv file>");
process.exit(1);
}
@@ -19,13 +19,13 @@ var lines = 0;
var columns = 0;
csvIn.addListener('end', function() {
- sys.debug('end');
- sys.debug(columns + ' columns, ' + lines + ' lines');
+ util.debug('end');
+ util.debug(columns + ' columns, ' + lines + ' lines');
});
csvIn.addListener('error', function(e) {
- sys.debug('error');
- sys.debug(e);
+ util.debug('error');
+ util.debug(e);
});
csvIn.addListener('data', function(data) {
@@ -37,7 +37,7 @@ var file = process.argv[2];
var fileIn = fs.createReadStream(file, {flags: 'r', bufferSize: 10});
fileIn.setEncoding('utf8');
fileIn.on('data', function(data) {
- sys.debug(data);
+ util.debug(data);
csvIn.parse(data);
});
fileIn.on('end', function(data) {

0 comments on commit 1400609

Please sign in to comment.