From 9ea316dbae74c4860e41eab42c3cd0a29aa4b1e8 Mon Sep 17 00:00:00 2001 From: Doug Martin Date: Sat, 19 Apr 2014 15:51:31 -0500 Subject: [PATCH] v0.2.4 * Added more fine grained control to `.pause` and `.resume` * You can now pause resume between chunks --- History.md | 5 +++++ Makefile | 3 +-- benchmark/benchmark.js | 10 +++++----- docs/History.html | 7 +++++++ lib/parser_stream.js | 43 ++++++++++++++++++++++++++++++++---------- package.json | 2 +- test/fast-csv.test.js | 31 +++++++++++++++++++++++++++--- 7 files changed, 80 insertions(+), 21 deletions(-) diff --git a/History.md b/History.md index bb527802..e26ce11d 100644 --- a/History.md +++ b/History.md @@ -1,3 +1,8 @@ +#0.2.4 + +* Added more fine grained control to `.pause` and `.resume` + * You can now pause resume between chunks + # 0.2.3 * Add new `createWriteStream` for creating a streaming csv writer diff --git a/Makefile b/Makefile index da20fec6..b585246d 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,10 @@ DOC_COMMAND=coddoc -f multi-html -d ./lib --dir ./docs -MD_COMMAND=coddoc -f markdown -d ./lib > README.md test: export NODE_PATH=$NODE_PATH:lib && ./node_modules/it/bin/it -r dotmatrix docs: docclean - $(DOC_COMMAND) && $(MD_COMMAND) + $(DOC_COMMAND) docclean : rm -rf docs/* diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js index b43c423b..863c2996 100644 --- a/benchmark/benchmark.js +++ b/benchmark/benchmark.js @@ -13,7 +13,7 @@ function camelize(str) { function benchmarkFastCsv(done) { var count = 0; - fastCsv + var stream = fastCsv .fromPath(TEST_FILE, {headers: true}) .transform(function (data) { var ret = {}; @@ -23,12 +23,12 @@ function benchmarkFastCsv(done) { ret.address = data.address; return ret; }) - .on("record", function () { - count++; + .on("record", function (data, i) { + count = i + 1; }) .on("end", function () { if (count !== COUNT) { - done(new Error("Error expected %d got %d", COUNT, count)); + done(new Error("Error expected " + COUNT + " got " + count)); } else { done(); } @@ -51,7 +51,7 @@ function benchmarkCsv(done) { ret.address = data[3]; return ret; }) - .on('record', function () { + .on('record', function (data) { count++; }) .on('end', function () { diff --git a/docs/History.html b/docs/History.html index 1660e4e8..9e7448fa 100644 --- a/docs/History.html +++ b/docs/History.html @@ -176,6 +176,13 @@ +

0.2.4

+

0.2.3