Comparing version 0.3.1 to 0.3.2
@@ -7,3 +7,3 @@ (function (global, factory) { | ||
var version = "0.3.1"; | ||
var version = "0.3.2"; | ||
@@ -132,3 +132,5 @@ function objectConverter(columns) { | ||
function formatValue(text) { | ||
return reFormat.test(text) ? "\"" + text.replace(/\"/g, "\"\"") + "\"" : text; | ||
return text == null ? "" | ||
: reFormat.test(text += "") ? "\"" + text.replace(/\"/g, "\"\"") + "\"" | ||
: text; | ||
} | ||
@@ -135,0 +137,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(r,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(r.d3_dsv=r.d3_dsv||{})}(this,function(r){"use strict";function n(r){return new Function("d","return {"+r.map(function(r,n){return JSON.stringify(r)+": d["+n+"]"}).join(",")+"}")}function t(r,t){var e=n(r);return function(n,o){return t(e(n),o,r)}}function e(r){var n=Object.create(null),t=[];return r.forEach(function(r){for(var e in r)e in n||t.push(n[e]=e)}),t}function o(r){function o(r,e){var o,u,i=a(r,function(r,a){return o?o(r,a-1):(u=r,void(o=e?t(r,e):n(r)))});return i.columns=u,i}function a(r,n){function t(){if(f>=s)return u;if(o)return o=!1,a;var n,t=f;if(34===r.charCodeAt(t)){for(var e=t;e++<s;)if(34===r.charCodeAt(e)){if(34!==r.charCodeAt(e+1))break;++e}return f=e+2,n=r.charCodeAt(e+1),13===n?(o=!0,10===r.charCodeAt(e+2)&&++f):10===n&&(o=!0),r.slice(t+1,e).replace(/""/g,'"')}for(;s>f;){var i=1;if(n=r.charCodeAt(f++),10===n)o=!0;else if(13===n)o=!0,10===r.charCodeAt(f)&&(++f,++i);else if(n!==p)continue;return r.slice(t,f-i)}return r.slice(t)}for(var e,o,a={},u={},i=[],s=r.length,f=0,c=0;(e=t())!==u;){for(var v=[];e!==a&&e!==u;)v.push(e),e=t();n&&null==(v=n(v,c++))||i.push(v)}return i}function u(n,t){return null==t&&(t=e(n)),[t.map(f).join(r)].concat(n.map(function(n){return t.map(function(r){return f(n[r])}).join(r)})).join("\n")}function i(r){return r.map(s).join("\n")}function s(n){return n.map(f).join(r)}function f(r){return c.test(r)?'"'+r.replace(/\"/g,'""')+'"':r}var c=new RegExp('["'+r+"\n]"),p=r.charCodeAt(0);return{parse:o,parseRows:a,format:u,formatRows:i}}var a="0.3.1",u=o(","),i=u.parse,s=u.parseRows,f=u.format,c=u.formatRows,p=o(" "),v=p.parse,d=p.parseRows,m=p.format,l=p.formatRows;r.version=a,r.dsvFormat=o,r.csvParse=i,r.csvParseRows=s,r.csvFormat=f,r.csvFormatRows=c,r.tsvParse=v,r.tsvParseRows=d,r.tsvFormat=m,r.tsvFormatRows=l}); | ||
!function(r,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(r.d3_dsv=r.d3_dsv||{})}(this,function(r){"use strict";function n(r){return new Function("d","return {"+r.map(function(r,n){return JSON.stringify(r)+": d["+n+"]"}).join(",")+"}")}function t(r,t){var e=n(r);return function(n,o){return t(e(n),o,r)}}function e(r){var n=Object.create(null),t=[];return r.forEach(function(r){for(var e in r)e in n||t.push(n[e]=e)}),t}function o(r){function o(r,e){var o,a,i=u(r,function(r,u){return o?o(r,u-1):(a=r,void(o=e?t(r,e):n(r)))});return i.columns=a,i}function u(r,n){function t(){if(f>=s)return a;if(o)return o=!1,u;var n,t=f;if(34===r.charCodeAt(t)){for(var e=t;e++<s;)if(34===r.charCodeAt(e)){if(34!==r.charCodeAt(e+1))break;++e}return f=e+2,n=r.charCodeAt(e+1),13===n?(o=!0,10===r.charCodeAt(e+2)&&++f):10===n&&(o=!0),r.slice(t+1,e).replace(/""/g,'"')}for(;s>f;){var i=1;if(n=r.charCodeAt(f++),10===n)o=!0;else if(13===n)o=!0,10===r.charCodeAt(f)&&(++f,++i);else if(n!==p)continue;return r.slice(t,f-i)}return r.slice(t)}for(var e,o,u={},a={},i=[],s=r.length,f=0,c=0;(e=t())!==a;){for(var v=[];e!==u&&e!==a;)v.push(e),e=t();n&&null==(v=n(v,c++))||i.push(v)}return i}function a(n,t){return null==t&&(t=e(n)),[t.map(f).join(r)].concat(n.map(function(n){return t.map(function(r){return f(n[r])}).join(r)})).join("\n")}function i(r){return r.map(s).join("\n")}function s(n){return n.map(f).join(r)}function f(r){return null==r?"":c.test(r+="")?'"'+r.replace(/\"/g,'""')+'"':r}var c=new RegExp('["'+r+"\n]"),p=r.charCodeAt(0);return{parse:o,parseRows:u,format:a,formatRows:i}}var u="0.3.2",a=o(","),i=a.parse,s=a.parseRows,f=a.format,c=a.formatRows,p=o(" "),v=p.parse,d=p.parseRows,m=p.format,l=p.formatRows;r.version=u,r.dsvFormat=o,r.csvParse=i,r.csvParseRows=s,r.csvFormat=f,r.csvFormatRows=c,r.tsvParse=v,r.tsvParseRows=d,r.tsvFormat=m,r.tsvFormatRows=l}); |
@@ -1,4 +0,4 @@ | ||
export {version} from "./build/version"; | ||
export {version} from "./build/package"; | ||
export {default as dsvFormat} from "./src/dsv"; | ||
export {csvParse, csvParseRows, csvFormat, csvFormatRows} from "./src/csv"; | ||
export {tsvParse, tsvParseRows, tsvFormat, tsvFormatRows} from "./src/tsv"; |
{ | ||
"name": "d3-dsv", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"description": "A parser and formatter for delimiter-separated values, such as CSV and TSV", | ||
@@ -30,9 +30,9 @@ "keywords": [ | ||
"scripts": { | ||
"pretest": "mkdir -p build && node -e 'process.stdout.write(\"export var version = \\\"\" + require(\"./package.json\").version + \"\\\";\\n\");' > build/version.js && rollup -f umd -n d3_dsv -o build/d3-dsv.js -- index.js", | ||
"test": "faucet `find test -name '*-test.js'` && eslint index.js src", | ||
"prepublish": "npm run test && uglifyjs build/d3-dsv.js -c -m -o build/d3-dsv.min.js && rm -f build/d3-dsv.zip", | ||
"postpublish": "VERSION=`node -e 'console.log(require(\"./package.json\").version)'`; git push && git push --tags && cp build/d3-dsv.js ../d3.github.com/d3-dsv.v0.3.js && cp build/d3-dsv.min.js ../d3.github.com/d3-dsv.v0.3.min.js && cd ../d3.github.com && git add d3-dsv.v0.3.js d3-dsv.v0.3.min.js && git commit -m \"d3-dsv ${VERSION}\" && git push && zip -j build/d3-dsv.zip -- LICENSE README.md build/d3-dsv.js build/d3-dsv.min.js" | ||
"pretest": "rm -rf build && mkdir build && json2module package.json > build/package.js && rollup -f umd -n d3_dsv -o build/d3-dsv.js -- index.js", | ||
"test": "tape 'test/**/*-test.js' && eslint index.js src", | ||
"prepublish": "npm run test && uglifyjs build/d3-dsv.js -c -m -o build/d3-dsv.min.js", | ||
"postpublish": "VERSION=`node -e 'console.log(require(\"./package.json\").version)'`; git push && git push --tags && cp build/d3-dsv.js ../d3.github.com/d3-dsv.v0.3.js && cp build/d3-dsv.min.js ../d3.github.com/d3-dsv.v0.3.min.js && cd ../d3.github.com && git add d3-dsv.v0.3.js d3-dsv.v0.3.min.js && git commit -m \"d3-dsv ${VERSION}\" && git push && cd - && zip -j build/d3-dsv.zip -- LICENSE README.md build/d3-dsv.js build/d3-dsv.min.js" | ||
}, | ||
"devDependencies": { | ||
"faucet": "0.0", | ||
"json2module": "0.0", | ||
"rollup": "0.25", | ||
@@ -39,0 +39,0 @@ "tape": "4", |
@@ -123,3 +123,5 @@ function objectConverter(columns) { | ||
function formatValue(text) { | ||
return reFormat.test(text) ? "\"" + text.replace(/\"/g, "\"\"") + "\"" : text; | ||
return text == null ? "" | ||
: reFormat.test(text += "") ? "\"" + text.replace(/\"/g, "\"\"") + "\"" | ||
: text; | ||
} | ||
@@ -126,0 +128,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27799
289