From 9c2f27ee781138fb795cb5b86c759df189254d1e Mon Sep 17 00:00:00 2001 From: David Worms Date: Tue, 28 Jan 2014 23:17:47 +0100 Subject: [PATCH] Generate with latest coffee --- lib/doc.js | 14 +++++++------- lib/from.js | 30 +++++++++++++++--------------- lib/generator.js | 10 +++++----- lib/index.js | 34 +++++++++++++++++----------------- lib/options.js | 6 +++--- lib/parser.js | 14 +++++++------- lib/state.js | 2 +- lib/stringifier.js | 14 +++++++------- lib/to.js | 30 +++++++++++++++--------------- lib/transformer.js | 18 +++++++++--------- lib/utils.js | 2 +- 11 files changed, 87 insertions(+), 87 deletions(-) diff --git a/lib/doc.js b/lib/doc.js index c421b7fe5..40f15c614 100644 --- a/lib/doc.js +++ b/lib/doc.js @@ -1,4 +1,4 @@ -// Generated by CoffeeScript 1.6.3 +// Generated by CoffeeScript 1.7.0 var convert_anchor, convert_code, date, docs, each, fs, getindent, mecano, path, unindent; fs = require('fs'); @@ -14,10 +14,10 @@ date = function() { return d = (new Date).toISOString(); }; + /* Find indentation based on the first line containing text -*/ - + */ getindent = function(text) { var line, _i, _len; @@ -33,10 +33,10 @@ getindent = function(text) { return ''; }; + /* Discover indentation in first line and remove it for every other lines -*/ - + */ unindent = function(lines) { var indent; @@ -48,10 +48,10 @@ unindent = function(lines) { return lines.join('\n'); }; + /* Create an anchor from the function name in the title -*/ - + */ convert_anchor = function(text) { var re_anchor; diff --git a/lib/from.js b/lib/from.js index fcbae8b0b..638e31de3 100644 --- a/lib/from.js +++ b/lib/from.js @@ -1,4 +1,4 @@ -// Generated by CoffeeScript 1.6.3 +// Generated by CoffeeScript 1.7.0 var Stream, fs, nextTick, path, timers, utils; fs = require('fs'); @@ -17,6 +17,7 @@ timers = require('timers'); nextTick = timers.setImmediate ? timers.setImmediate : process.nextTick; + /* Reading data from a source @@ -31,10 +32,10 @@ here are two identical ways to read from a file: csv().from('/tmp/data.csv').on('data', console.log); csv().from.path('/tmp/data.csv').on('data', console.log); -*/ - + */ module.exports = function(csv) { + /* `from(mixed)` @@ -64,8 +65,7 @@ module.exports = function(csv) { csv() .from(['"1","2","3","4","5"',['1','2','3','4','5']]) .on('end', function(){ console.log('done') }) - */ - + */ var from; from = function(mixed, options) { var error; @@ -99,6 +99,7 @@ module.exports = function(csv) { } return csv; }; + /* `from.options([options])` @@ -121,8 +122,7 @@ module.exports = function(csv) { Additionnally, in case you are working with stream, you can pass all the options accepted by the `stream.pipe` function. - */ - + */ from.options = function(options) { if (options != null) { utils.merge(csv.options.from, options); @@ -131,6 +131,7 @@ module.exports = function(csv) { return csv.options.from; } }; + /* `from.array(data, [options])` @@ -140,8 +141,7 @@ module.exports = function(csv) { an object of options as a second argument. Each element of the array represents a CSV record. Those elements may be a string, a buffer, an array or an object. - */ - + */ from.array = function(data, options) { this.options(options); nextTick(function() { @@ -154,6 +154,7 @@ module.exports = function(csv) { }); return csv; }; + /* `from.string(data, [options])` @@ -167,8 +168,7 @@ module.exports = function(csv) { csv() .from( '"1","2","3","4"\n"a","b","c","d"' ) .to( function(data){} ) - */ - + */ from.string = function(data, options) { this.options(options); nextTick(function() { @@ -177,6 +177,7 @@ module.exports = function(csv) { }); return csv; }; + /* `from.stream(stream, [options])` @@ -189,8 +190,7 @@ module.exports = function(csv) { documentation][srpdo] for additionnal information. [srpdo]: http://www.nodejs.org/api/stream.html#stream_readable_pipe_destination_options - */ - + */ from.stream = function(stream, options) { if (options) { this.options(options); @@ -201,6 +201,7 @@ module.exports = function(csv) { stream.pipe(csv, csv.from.options()); return csv; }; + /* `from.path(path, [options])` @@ -221,8 +222,7 @@ module.exports = function(csv) { See the [`fs.createReadStream` documentation][fscpo] for additionnal information. [fscpo]: http://www.nodejs.org/api/fs.html#fs_fs_createreadstream_path_options - */ - + */ from.path = function(path, options) { var stream; this.options(options); diff --git a/lib/generator.js b/lib/generator.js index 01796f307..56ca3ec63 100644 --- a/lib/generator.js +++ b/lib/generator.js @@ -1,4 +1,4 @@ -// Generated by CoffeeScript 1.6.3 +// Generated by CoffeeScript 1.7.0 var Generator, Stream, nextTick, timers, util; Stream = require('stream'); @@ -9,6 +9,7 @@ timers = require('timers'); nextTick = timers.setImmediate ? timers.setImmediate : process.nextTick; + /* `generator([options])`: Generate random CSV data @@ -32,8 +33,7 @@ Starting a generation csv = require 'csv' generator = csv.generator generator(start: true).pipe csv().to.path "#{__dirname}/perf.out" -*/ - + */ Generator = function(options) { var _base, _base1; @@ -86,14 +86,14 @@ Generator.prototype.destroy = function() { return this.emit('close'); }; + /* `setEncoding([encoding])` Makes the 'data' event emit a string instead of a Buffer. encoding can be 'utf8', 'utf16le' ('ucs2'), 'ascii', or 'hex'. Defaults to 'utf8'. -*/ - + */ Generator.prototype.setEncoding = function(encoding) { return this.options.encoding = encoding; diff --git a/lib/index.js b/lib/index.js index 3cb49a70a..d23896747 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1,4 +1,5 @@ -// Generated by CoffeeScript 1.6.3 +// Generated by CoffeeScript 1.7.0 + /* Node CSV @@ -155,8 +156,7 @@ functions to retrieve the text or to write to plug a Stream Writer. Note, even though the "parser", "transformer" and "singifier" are available as properties, you won't have to interact with those. -*/ - + */ var CSV, from, options, parser, state, stream, stringifier, to, transformer, utils; stream = require('stream'); @@ -218,6 +218,7 @@ CSV = function() { CSV.prototype.__proto__ = stream.prototype; + /* `pause()` @@ -225,14 +226,14 @@ CSV.prototype.__proto__ = stream.prototype; Implementation of the Readable Stream API, requesting that no further data be sent until resume() is called. -*/ - + */ CSV.prototype.pause = function() { this.paused = true; return this; }; + /* `resume()` @@ -240,8 +241,7 @@ CSV.prototype.pause = function() { Implementation of the Readable Stream API, resuming the incoming 'data' events after a pause(). -*/ - + */ CSV.prototype.resume = function() { this.paused = false; @@ -249,6 +249,7 @@ CSV.prototype.resume = function() { return this; }; + /* `write(data, [preserve])` @@ -260,8 +261,7 @@ may be a string, a buffer, an array or an object. If data is a string or a buffer, it could span multiple lines. If data is an object or an array, it must represent a single line. Preserve is for line which are not considered as CSV data. -*/ - + */ CSV.prototype.write = function(chunk, preserve) { var csv; @@ -286,6 +286,7 @@ CSV.prototype.write = function(chunk, preserve) { return !this.paused; }; + /* `end()` @@ -294,8 +295,7 @@ CSV.prototype.write = function(chunk, preserve) { Terminate the parsing. Call this method when no more csv data is to be parsed. It implement the StreamWriter API by setting the `writable` property to "false" and emitting the `end` event. -*/ - + */ CSV.prototype.end = function() { if (!this.writable) { @@ -307,6 +307,7 @@ CSV.prototype.end = function() { return this; }; + /* `transform(callback, [options])` @@ -315,8 +316,7 @@ CSV.prototype.end = function() { Register the transformer callback. The callback is a user provided function call on each line to filter, enrich or modify the dataset. More information in the "transforming data" section. -*/ - + */ CSV.prototype.transform = function(callback, options) { this.transformer.callback = callback; @@ -326,6 +326,7 @@ CSV.prototype.transform = function(callback, options) { return this; }; + /* `error(error)` @@ -333,8 +334,7 @@ CSV.prototype.transform = function(callback, options) { Unified mechanism to handle error, emit the error and mark the stream as non readable and non writable. -*/ - + */ CSV.prototype.error = function(e) { this.readable = false; @@ -350,10 +350,10 @@ module.exports = function() { return new CSV; }; + /* [event]: http://nodejs.org/api/events.html [stream]: http://nodejs.org/api/stream.html [writable_stream]: http://nodejs.org/api/stream.html#stream_writable_stream [readable_stream]: http://nodejs.org/api/stream.html#stream_readable_stream -*/ - + */ diff --git a/lib/options.js b/lib/options.js index 24fd79745..d2a1b581f 100644 --- a/lib/options.js +++ b/lib/options.js @@ -1,4 +1,5 @@ -// Generated by CoffeeScript 1.6.3 +// Generated by CoffeeScript 1.7.0 + /* Input and output options ======================== @@ -6,8 +7,7 @@ Input and output options The `options` property provide access to the `from` and `to` object used to store options. This property is for internal usage and could be considered private. It is recommanded to use the `from.options()` and `to.options()` to access those objects. -*/ - + */ module.exports = function() { return { from: { diff --git a/lib/parser.js b/lib/parser.js index 85aeedbd2..e126a9ea2 100644 --- a/lib/parser.js +++ b/lib/parser.js @@ -1,8 +1,9 @@ -// Generated by CoffeeScript 1.6.3 +// Generated by CoffeeScript 1.7.0 var EventEmitter, Parser; EventEmitter = require('events').EventEmitter; + /* Parsing @@ -16,8 +17,7 @@ The library extend the [EventEmitter][event] and emit the following events: Emitted when no more data will be parsed. * *error* Emitted when an error occured. -*/ - + */ Parser = function(csv) { this.csv = csv; @@ -36,6 +36,7 @@ Parser = function(csv) { Parser.prototype.__proto__ = EventEmitter.prototype; + /* `write(chars)` @@ -44,8 +45,7 @@ Parser.prototype.__proto__ = EventEmitter.prototype; Parse a string which may hold multiple lines. Private state object is enriched on each character until transform is called on a new line. -*/ - + */ Parser.prototype.write = function(chars, end) { var areNextCharsRowDelimiters, char, delimLength, escapeIsQuote, i, isDelimiter, isEscape, isQuote, isRowDelimiter, l, ltrim, nextNextCharPas, nextNextCharPos, rowDelimiter, rtrim, _results; @@ -189,7 +189,7 @@ module.exports = function(csv) { module.exports.Parser = Parser; + /* [event]: http://nodejs.org/api/events.html -*/ - + */ diff --git a/lib/state.js b/lib/state.js index e9420c6eb..f11dbfdec 100644 --- a/lib/state.js +++ b/lib/state.js @@ -1,4 +1,4 @@ -// Generated by CoffeeScript 1.6.3 +// Generated by CoffeeScript 1.7.0 module.exports = function() { return { count: 0, diff --git a/lib/stringifier.js b/lib/stringifier.js index 8be543464..abd0c4741 100644 --- a/lib/stringifier.js +++ b/lib/stringifier.js @@ -1,12 +1,12 @@ -// Generated by CoffeeScript 1.6.3 +// Generated by CoffeeScript 1.7.0 + /* Stringifier =========== Convert an array or an object into a CSV line. -*/ - + */ var Stringifier, __hasProp = {}.hasOwnProperty; @@ -15,6 +15,7 @@ Stringifier = function(csv) { return this; }; + /* `write(line, [preserve])` @@ -22,8 +23,7 @@ Stringifier = function(csv) { Write a line to the written stream. Line may be an object, an array or a string The `preserve` argument is for the lines which are not considered as CSV data. -*/ - + */ Stringifier.prototype.write = function(line) { var e, preserve; @@ -50,14 +50,14 @@ Stringifier.prototype.write = function(line) { return true; }; + /* `Stringifier(line)` ------------------- Convert a line to a string. Line may be an object, an array or a string. -*/ - + */ Stringifier.prototype.stringify = function(line) { var column, columns, containsLinebreak, containsQuote, containsdelimiter, delimiter, e, escape, field, i, newLine, quote, regexp, _i, _j, _line, _ref, _ref1; diff --git a/lib/to.js b/lib/to.js index 47cf4a3a5..3f65ddece 100644 --- a/lib/to.js +++ b/lib/to.js @@ -1,4 +1,4 @@ -// Generated by CoffeeScript 1.6.3 +// Generated by CoffeeScript 1.7.0 var Stream, fs, utils; fs = require('fs'); @@ -7,6 +7,7 @@ Stream = require('stream'); utils = require('./utils'); + /* Writing data to a destination @@ -21,10 +22,10 @@ here are two identical ways to write to a file: csv.from(data).to('/tmp/data.csv'); csv.from(data).to.path('/tmp/data.csv'); -*/ - + */ module.exports = function(csv) { + /* `to(mixed)` @@ -51,8 +52,7 @@ module.exports = function(csv) { csv() .from('"1","2","3","4","5"') .to(fs.createWriteStream('./path/to/file.csv')) - */ - + */ var to; to = function(mixed, options) { var error; @@ -79,6 +79,7 @@ module.exports = function(csv) { } return csv; }; + /* `to.options([options])` @@ -101,8 +102,7 @@ module.exports = function(csv) { The end options is similar to passing `{end: false}` option in `stream.pipe()`. According to the Node.js documentation: > By default end() is called on the destination when the source stream emits end, so that destination is no longer writable. Pass { end: false } as options to keep the destination stream open. - */ - + */ to.options = function(options) { if (options != null) { utils.merge(csv.options.to, options); @@ -133,6 +133,7 @@ module.exports = function(csv) { return csv.options.to; } }; + /* `to.string(callback, [options])` @@ -147,8 +148,7 @@ module.exports = function(csv) { Callback is called with 2 arguments: * data Entire CSV as a string * count Number of stringified records - */ - + */ to.string = function(callback, options) { var data, stream; this.options(options); @@ -165,6 +165,7 @@ module.exports = function(csv) { csv.pipe(stream); return csv; }; + /* `to.stream(stream, [options])` @@ -177,8 +178,7 @@ module.exports = function(csv) { documentation][srpdo] for additionnal information. [srpdo]: http://www.nodejs.org/api/stream.html#stream_readable_pipe_destination_options - */ - + */ to.stream = function(stream, options) { this.options(options); csv.pipe(stream, csv.options.to); @@ -193,6 +193,7 @@ module.exports = function(csv) { }); return csv; }; + /* `to.path(path, [options])` @@ -219,8 +220,7 @@ module.exports = function(csv) { .to.file('my.csv', {flags:'r+'}) .write(['hello', 'node']) .end() - */ - + */ to.path = function(path, options) { var stream; this.options(options); @@ -230,6 +230,7 @@ module.exports = function(csv) { csv.to.stream(stream, null); return csv; }; + /* `to.array(path, [options])` @@ -244,8 +245,7 @@ module.exports = function(csv) { Callback is called with 2 arguments: * data Entire CSV as an array of records * count Number of stringified records - */ - + */ to.array = function(callback, options) { var records; this.options(options); diff --git a/lib/transformer.js b/lib/transformer.js index e2c74ff4f..82c55d46d 100644 --- a/lib/transformer.js +++ b/lib/transformer.js @@ -1,4 +1,4 @@ -// Generated by CoffeeScript 1.6.3 +// Generated by CoffeeScript 1.7.0 var Transformer, nextTick, stream, timers; stream = require('stream'); @@ -7,6 +7,7 @@ timers = require('timers'); nextTick = timers.setImmediate ? timers.setImmediate : process.nextTick; + /* Transforming data ================= @@ -79,8 +80,7 @@ Transform callback returning a string: }); // Executing `node samples/transform.js`, print: // 82:Zbigniew Preisner,94:Serge Gainsbourg -*/ - + */ Transformer = function(csv) { this.csv = csv; @@ -94,14 +94,14 @@ Transformer = function(csv) { Transformer.prototype.__proto__ = stream.prototype; + /* no doc `headers()` ---------------------------- Print headers. -*/ - + */ Transformer.prototype.headers = function() { var k, label, labels; @@ -120,6 +120,7 @@ Transformer.prototype.headers = function() { return this.csv.stringifier.write(labels); }; + /* no doc `write(line)` @@ -127,8 +128,7 @@ Transformer.prototype.headers = function() { Call a callback to transform a line. Called for each line after being parsed. It is responsible for transforming the data and finally calling `write`. -*/ - + */ Transformer.prototype.write = function(line) { var column, columns, csv, done, finish, i, lineAsObject, run, self, sync, _i, _j, _len, _len1; @@ -223,14 +223,14 @@ Transformer.prototype.write = function(line) { return true; }; + /* no doc `end()` ------------------------ A transformer instance extends the EventEmitter and emit the 'end' event when the last callback is called. -*/ - + */ Transformer.prototype.end = function() { if (this.closed) { diff --git a/lib/utils.js b/lib/utils.js index a7ea5d504..6270fc1e4 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -1,4 +1,4 @@ -// Generated by CoffeeScript 1.6.3 +// Generated by CoffeeScript 1.7.0 module.exports = { merge: function(obj1, obj2) { var key, r;