csv-generate
Advanced tools
Comparing version 0.0.6 to 1.0.0
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.7.1 | ||
// Generated by CoffeeScript 1.10.0 | ||
var Generator, stream, util; | ||
@@ -27,8 +27,8 @@ | ||
generator.on('readable', function() { | ||
var d, _results; | ||
_results = []; | ||
var d, results; | ||
results = []; | ||
while (d = generator.read()) { | ||
_results.push(data.push(options.objectMode ? d : d.toString())); | ||
results.push(data.push(options.objectMode ? d : d.toString())); | ||
} | ||
return _results; | ||
return results; | ||
}); | ||
@@ -43,18 +43,18 @@ generator.on('error', callback); | ||
Generator = function(options) { | ||
var i, v, _base, _base1, _base2, _base3, _base4, _base5, _base6, _base7, _base8, _i, _len, _ref; | ||
this.options = options != null ? options : {}; | ||
Generator = function(options1) { | ||
var base, base1, base2, base3, base4, base5, base6, base7, base8, i, j, len, ref, v; | ||
this.options = options1 != null ? options1 : {}; | ||
stream.Readable.call(this, this.options); | ||
this.options.count = 0; | ||
if ((_base = this.options).duration == null) { | ||
_base.duration = 4 * 60 * 1000; | ||
if ((base = this.options).duration == null) { | ||
base.duration = 4 * 60 * 1000; | ||
} | ||
if ((_base1 = this.options).columns == null) { | ||
_base1.columns = 8; | ||
if ((base1 = this.options).columns == null) { | ||
base1.columns = 8; | ||
} | ||
if ((_base2 = this.options).max_word_length == null) { | ||
_base2.max_word_length = 16; | ||
if ((base2 = this.options).max_word_length == null) { | ||
base2.max_word_length = 16; | ||
} | ||
if ((_base3 = this.options).fixed_size == null) { | ||
_base3.fixed_size = false; | ||
if ((base3 = this.options).fixed_size == null) { | ||
base3.fixed_size = false; | ||
} | ||
@@ -64,16 +64,16 @@ if (this.fixed_size_buffer == null) { | ||
} | ||
if ((_base4 = this.options).start == null) { | ||
_base4.start = Date.now(); | ||
if ((base4 = this.options).start == null) { | ||
base4.start = Date.now(); | ||
} | ||
if ((_base5 = this.options).end == null) { | ||
_base5.end = null; | ||
if ((base5 = this.options).end == null) { | ||
base5.end = null; | ||
} | ||
if ((_base6 = this.options).seed == null) { | ||
_base6.seed = false; | ||
if ((base6 = this.options).seed == null) { | ||
base6.seed = false; | ||
} | ||
if ((_base7 = this.options).length == null) { | ||
_base7.length = -1; | ||
if ((base7 = this.options).length == null) { | ||
base7.length = -1; | ||
} | ||
if ((_base8 = this.options).delimiter == null) { | ||
_base8.delimiter = ','; | ||
if ((base8 = this.options).delimiter == null) { | ||
base8.delimiter = ','; | ||
} | ||
@@ -85,5 +85,5 @@ this.count_written = 0; | ||
} | ||
_ref = this.options.columns; | ||
for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) { | ||
v = _ref[i]; | ||
ref = this.options.columns; | ||
for (i = j = 0, len = ref.length; j < len; i = ++j) { | ||
v = ref[i]; | ||
if (v == null) { | ||
@@ -116,3 +116,3 @@ v = 'ascii'; | ||
Generator.prototype._read = function(size) { | ||
var column, data, header, length, line, lineLength, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref; | ||
var column, data, header, j, k, l, len, len1, len2, len3, length, line, lineLength, m, ref; | ||
data = []; | ||
@@ -127,4 +127,4 @@ length = this.fixed_size_buffer.length; | ||
if (this.options.objectMode) { | ||
for (_i = 0, _len = data.length; _i < _len; _i++) { | ||
line = data[_i]; | ||
for (j = 0, len = data.length; j < len; j++) { | ||
line = data[j]; | ||
this.count_written++; | ||
@@ -141,5 +141,5 @@ this.push(line); | ||
line = []; | ||
_ref = this.options.columns; | ||
for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) { | ||
header = _ref[_j]; | ||
ref = this.options.columns; | ||
for (k = 0, len1 = ref.length; k < len1; k++) { | ||
header = ref[k]; | ||
line.push("" + (header(this))); | ||
@@ -149,4 +149,4 @@ } | ||
lineLength = 0; | ||
for (_k = 0, _len2 = line.length; _k < _len2; _k++) { | ||
column = line[_k]; | ||
for (l = 0, len2 = line.length; l < len2; l++) { | ||
column = line[l]; | ||
lineLength += column.length; | ||
@@ -162,4 +162,4 @@ } | ||
data.push(line); | ||
for (_l = 0, _len3 = data.length; _l < _len3; _l++) { | ||
line = data[_l]; | ||
for (m = 0, len3 = data.length; m < len3; m++) { | ||
line = data[m]; | ||
this.count_written++; | ||
@@ -186,5 +186,5 @@ this.push(line); | ||
Generator.ascii = function(gen) { | ||
var char, column, nb_chars, _i, _ref; | ||
var char, column, j, nb_chars, ref; | ||
column = []; | ||
for (nb_chars = _i = 0, _ref = Math.ceil(gen.random() * gen.options.max_word_length); 0 <= _ref ? _i < _ref : _i > _ref; nb_chars = 0 <= _ref ? ++_i : --_i) { | ||
for (nb_chars = j = 0, ref = Math.ceil(gen.random() * gen.options.max_word_length); 0 <= ref ? j < ref : j > ref; nb_chars = 0 <= ref ? ++j : --j) { | ||
char = Math.floor(gen.random() * 32); | ||
@@ -191,0 +191,0 @@ column.push(String.fromCharCode(char + (char < 16 ? 65 : 97 - 16))); |
{ | ||
"version": "0.0.6", | ||
"version": "1.0.0", | ||
"name": "csv-generate", | ||
@@ -25,2 +25,2 @@ "description": "CSV and object generation implementing the Node.js `stream.Readable` API", | ||
} | ||
} | ||
} |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1
11390