Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

csv-generate

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

csv-generate - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

README.md

85

lib/index.js

@@ -71,2 +71,3 @@ // Generated by CoffeeScript 1.7.1

stream.Readable.call(this, this.options);
this.options.count = 0;
if ((_base = this.options).duration == null) {

@@ -84,17 +85,20 @@ _base.duration = 4 * 60 * 1000;

}
if ((_base4 = this.options).fixed_size_buffer == null) {
_base4.fixed_size_buffer = '';
if (this.fixed_size_buffer == null) {
this.fixed_size_buffer = '';
}
if ((_base5 = this.options).start == null) {
_base5.start = Date.now();
if ((_base4 = this.options).start == null) {
_base4.start = Date.now();
}
if ((_base6 = this.options).end == null) {
_base6.end = null;
if ((_base5 = this.options).end == null) {
_base5.end = null;
}
if ((_base7 = this.options).seed == null) {
_base7.seed = false;
if ((_base6 = this.options).seed == null) {
_base6.seed = false;
}
if ((_base8 = this.options).length == null) {
_base8.length = -1;
if ((_base7 = this.options).length == null) {
_base7.length = -1;
}
if ((_base8 = this.options).delimiter == null) {
_base8.delimiter = ',';
}
this.count = 0;

@@ -119,2 +123,9 @@ if (typeof this.options.headers === 'number') {

/*
`random`
Generate a random number between 0 and 1 with 2 decimals.
*/
Generator.prototype.random = function() {

@@ -135,8 +146,8 @@ if (this.options.seed) {

data = [];
length = this.options.fixed_size_buffer.length;
length = this.fixed_size_buffer.length;
if (length) {
data.push(this.options.fixed_size_buffer);
data.push(this.fixed_size_buffer);
}
while (true) {
if ((this.count++ === this.options.length) || (this.options.end && Date.now() > this.options.end)) {
if ((this.count + data.length === this.options.length) || (this.options.end && Date.now() > this.options.end)) {
if (data.length) {

@@ -146,5 +157,7 @@ if (this.options.objectMode) {

line = data[_i];
this.count++;
this.push(line);
}
} else {
this.count++;
this.push(data.join(''));

@@ -168,3 +181,3 @@ }

} else {
line = "" + (this.count === 1 ? '' : '\n') + (line.join(','));
line = "" + (this.count + data.length === 0 ? '' : '\n') + (line.join(this.options.delimiter));
lineLength = line.length;

@@ -177,2 +190,3 @@ }

line = data[_l];
this.count++;
this.push(line);

@@ -182,3 +196,3 @@ }

if (this.options.fixed_size) {
this.options.fixed_size_buffer = line.substr(size - length);
this.fixed_size_buffer = line.substr(size - length);
data.push(line.substr(0, size - length));

@@ -188,2 +202,3 @@ } else {

}
this.count++;
this.push(data.join(''));

@@ -216,6 +231,42 @@ }

module.exports = function(options) {
return new Generator(options);
/*
`generate([options])`
`generate([options], callback)`
*/
module.exports = function() {
var callback, data, generator, options;
if (arguments.length === 2) {
options = arguments[0];
callback = arguments[1];
} else if (arguments.length === 1) {
if (typeof arguments[0] === 'function') {
options = {};
callback = arguments[0];
} else {
options = arguments[0];
}
} else if (arguments.length === 0) {
options = {};
}
generator = new Generator(options);
if (callback) {
data = [];
generator.on('readable', function() {
var d, _results;
_results = [];
while (d = generator.read()) {
_results.push(data.push(options.objectMode ? d : d.toString()));
}
return _results;
});
generator.on('error', callback);
generator.on('end', function() {
return callback(null, options.objectMode ? data : data.join(''));
});
}
return generator;
};
module.exports.Generator = Generator;

3

package.json
{
"version": "0.0.1",
"version": "0.0.2",
"name": "csv-generate",

@@ -9,2 +9,3 @@ "description": "CSV and object generation implementing the Node.js `stream.Readable` API",

},
"keywords": [ "stream", "generate", "csv", "object" ],
"dependencies": {},

@@ -11,0 +12,0 @@ "devDependencies": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc