Comparing version 1.2.0 to 2.0.0-rc.1
@@ -1,2 +0,2 @@ | ||
// https://d3js.org/d3-dsv/ v1.2.0 Copyright 2019 Mike Bostock | ||
// https://d3js.org/d3-dsv/ v2.0.0-rc.1 Copyright 2020 Mike Bostock | ||
(function (global, factory) { | ||
@@ -212,3 +212,3 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
// https://github.com/d3/d3-dsv/issues/45 | ||
var fixtz = new Date("2019-01-01T00:00").getHours() || new Date("2019-07-01T00:00").getHours(); | ||
const fixtz = new Date("2019-01-01T00:00").getHours() || new Date("2019-07-01T00:00").getHours(); | ||
@@ -215,0 +215,0 @@ exports.autoType = autoType; |
@@ -1,2 +0,2 @@ | ||
// https://d3js.org/d3-dsv/ v1.2.0 Copyright 2019 Mike Bostock | ||
!function(r,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((r=r||self).d3=r.d3||{})}(this,function(r){"use strict";var t={},e={},n=34,o=10,a=13;function u(r){return new Function("d","return {"+r.map(function(r,t){return JSON.stringify(r)+": d["+t+'] || ""'}).join(",")+"}")}function f(r){var t=Object.create(null),e=[];return r.forEach(function(r){for(var n in r)n in t||e.push(t[n]=n)}),e}function i(r,t){var e=r+"",n=e.length;return n<t?new Array(t-n+1).join(0)+e:e}function s(r){var t,e=r.getUTCHours(),n=r.getUTCMinutes(),o=r.getUTCSeconds(),a=r.getUTCMilliseconds();return isNaN(r)?"Invalid Date":((t=r.getUTCFullYear())<0?"-"+i(-t,6):t>9999?"+"+i(t,6):i(t,4))+"-"+i(r.getUTCMonth()+1,2)+"-"+i(r.getUTCDate(),2)+(a?"T"+i(e,2)+":"+i(n,2)+":"+i(o,2)+"."+i(a,3)+"Z":o?"T"+i(e,2)+":"+i(n,2)+":"+i(o,2)+"Z":n||e?"T"+i(e,2)+":"+i(n,2)+"Z":"")}function c(r){var i=new RegExp('["'+r+"\n\r]"),c=r.charCodeAt(0);function l(r,u){var f,i=[],s=r.length,l=0,d=0,m=s<=0,v=!1;function p(){if(m)return e;if(v)return v=!1,t;var u,f,i=l;if(r.charCodeAt(i)===n){for(;l++<s&&r.charCodeAt(l)!==n||r.charCodeAt(++l)===n;);return(u=l)>=s?m=!0:(f=r.charCodeAt(l++))===o?v=!0:f===a&&(v=!0,r.charCodeAt(l)===o&&++l),r.slice(i+1,u-1).replace(/""/g,'"')}for(;l<s;){if((f=r.charCodeAt(u=l++))===o)v=!0;else if(f===a)v=!0,r.charCodeAt(l)===o&&++l;else if(f!==c)continue;return r.slice(i,u)}return m=!0,r.slice(i,s)}for(r.charCodeAt(s-1)===o&&--s,r.charCodeAt(s-1)===a&&--s;(f=p())!==e;){for(var w=[];f!==t&&f!==e;)w.push(f),f=p();u&&null==(w=u(w,d++))||i.push(w)}return i}function d(t,e){return t.map(function(t){return e.map(function(r){return v(t[r])}).join(r)})}function m(t){return t.map(v).join(r)}function v(r){return null==r?"":r instanceof Date?s(r):i.test(r+="")?'"'+r.replace(/"/g,'""')+'"':r}return{parse:function(r,t){var e,n,o=l(r,function(r,o){if(e)return e(r,o-1);n=r,e=t?function(r,t){var e=u(r);return function(n,o){return t(e(n),o,r)}}(r,t):u(r)});return o.columns=n||[],o},parseRows:l,format:function(t,e){return null==e&&(e=f(t)),[e.map(v).join(r)].concat(d(t,e)).join("\n")},formatBody:function(r,t){return null==t&&(t=f(r)),d(r,t).join("\n")},formatRows:function(r){return r.map(m).join("\n")},formatRow:m,formatValue:v}}var l=c(","),d=l.parse,m=l.parseRows,v=l.format,p=l.formatBody,w=l.formatRows,h=l.formatRow,C=l.formatValue,g=c("\t"),R=g.parse,T=g.parseRows,F=g.format,y=g.formatBody,j=g.formatRows,A=g.formatRow,N=g.formatValue;var U=new Date("2019-01-01T00:00").getHours()||new Date("2019-07-01T00:00").getHours();r.autoType=function(r){for(var t in r){var e,n,o=r[t].trim();if(o)if("true"===o)o=!0;else if("false"===o)o=!1;else if("NaN"===o)o=NaN;else if(isNaN(e=+o)){if(!(n=o.match(/^([-+]\d{2})?\d{4}(-\d{2}(-\d{2})?)?(T\d{2}:\d{2}(:\d{2}(\.\d{3})?)?(Z|[-+]\d{2}:\d{2})?)?$/)))continue;U&&n[4]&&!n[7]&&(o=o.replace(/-/g,"/").replace(/T/," ")),o=new Date(o)}else o=e;else o=null;r[t]=o}return r},r.csvFormat=v,r.csvFormatBody=p,r.csvFormatRow=h,r.csvFormatRows=w,r.csvFormatValue=C,r.csvParse=d,r.csvParseRows=m,r.dsvFormat=c,r.tsvFormat=F,r.tsvFormatBody=y,r.tsvFormatRow=A,r.tsvFormatRows=j,r.tsvFormatValue=N,r.tsvParse=R,r.tsvParseRows=T,Object.defineProperty(r,"__esModule",{value:!0})}); | ||
// https://d3js.org/d3-dsv/ v2.0.0-rc.1 Copyright 2020 Mike Bostock | ||
!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((t=t||self).d3=t.d3||{})}(this,function(t){"use strict";var r={},e={},n=34,o=10,a=13;function u(t){return new Function("d","return {"+t.map(function(t,r){return JSON.stringify(t)+": d["+r+'] || ""'}).join(",")+"}")}function f(t){var r=Object.create(null),e=[];return t.forEach(function(t){for(var n in t)n in r||e.push(r[n]=n)}),e}function i(t,r){var e=t+"",n=e.length;return n<r?new Array(r-n+1).join(0)+e:e}function s(t){var r,e=t.getUTCHours(),n=t.getUTCMinutes(),o=t.getUTCSeconds(),a=t.getUTCMilliseconds();return isNaN(t)?"Invalid Date":((r=t.getUTCFullYear())<0?"-"+i(-r,6):r>9999?"+"+i(r,6):i(r,4))+"-"+i(t.getUTCMonth()+1,2)+"-"+i(t.getUTCDate(),2)+(a?"T"+i(e,2)+":"+i(n,2)+":"+i(o,2)+"."+i(a,3)+"Z":o?"T"+i(e,2)+":"+i(n,2)+":"+i(o,2)+"Z":n||e?"T"+i(e,2)+":"+i(n,2)+"Z":"")}function c(t){var i=new RegExp('["'+t+"\n\r]"),c=t.charCodeAt(0);function l(t,u){var f,i=[],s=t.length,l=0,d=0,m=s<=0,v=!1;function p(){if(m)return e;if(v)return v=!1,r;var u,f,i=l;if(t.charCodeAt(i)===n){for(;l++<s&&t.charCodeAt(l)!==n||t.charCodeAt(++l)===n;);return(u=l)>=s?m=!0:(f=t.charCodeAt(l++))===o?v=!0:f===a&&(v=!0,t.charCodeAt(l)===o&&++l),t.slice(i+1,u-1).replace(/""/g,'"')}for(;l<s;){if((f=t.charCodeAt(u=l++))===o)v=!0;else if(f===a)v=!0,t.charCodeAt(l)===o&&++l;else if(f!==c)continue;return t.slice(i,u)}return m=!0,t.slice(i,s)}for(t.charCodeAt(s-1)===o&&--s,t.charCodeAt(s-1)===a&&--s;(f=p())!==e;){for(var w=[];f!==r&&f!==e;)w.push(f),f=p();u&&null==(w=u(w,d++))||i.push(w)}return i}function d(r,e){return r.map(function(r){return e.map(function(t){return v(r[t])}).join(t)})}function m(r){return r.map(v).join(t)}function v(t){return null==t?"":t instanceof Date?s(t):i.test(t+="")?'"'+t.replace(/"/g,'""')+'"':t}return{parse:function(t,r){var e,n,o=l(t,function(t,o){if(e)return e(t,o-1);n=t,e=r?function(t,r){var e=u(t);return function(n,o){return r(e(n),o,t)}}(t,r):u(t)});return o.columns=n||[],o},parseRows:l,format:function(r,e){return null==e&&(e=f(r)),[e.map(v).join(t)].concat(d(r,e)).join("\n")},formatBody:function(t,r){return null==r&&(r=f(t)),d(t,r).join("\n")},formatRows:function(t){return t.map(m).join("\n")},formatRow:m,formatValue:v}}var l=c(","),d=l.parse,m=l.parseRows,v=l.format,p=l.formatBody,w=l.formatRows,h=l.formatRow,C=l.formatValue,g=c("\t"),R=g.parse,T=g.parseRows,F=g.format,y=g.formatBody,j=g.formatRows,A=g.formatRow,N=g.formatValue;const U=new Date("2019-01-01T00:00").getHours()||new Date("2019-07-01T00:00").getHours();t.autoType=function(t){for(var r in t){var e,n,o=t[r].trim();if(o)if("true"===o)o=!0;else if("false"===o)o=!1;else if("NaN"===o)o=NaN;else if(isNaN(e=+o)){if(!(n=o.match(/^([-+]\d{2})?\d{4}(-\d{2}(-\d{2})?)?(T\d{2}:\d{2}(:\d{2}(\.\d{3})?)?(Z|[-+]\d{2}:\d{2})?)?$/)))continue;U&&n[4]&&!n[7]&&(o=o.replace(/-/g,"/").replace(/T/," ")),o=new Date(o)}else o=e;else o=null;t[r]=o}return t},t.csvFormat=v,t.csvFormatBody=p,t.csvFormatRow=h,t.csvFormatRows=w,t.csvFormatValue=C,t.csvParse=d,t.csvParseRows=m,t.dsvFormat=c,t.tsvFormat=F,t.tsvFormatBody=y,t.tsvFormatRow=A,t.tsvFormatRows=j,t.tsvFormatValue=N,t.tsvParse=R,t.tsvParseRows=T,Object.defineProperty(t,"__esModule",{value:!0})}); |
{ | ||
"name": "d3-dsv", | ||
"version": "1.2.0", | ||
"version": "2.0.0-rc.1", | ||
"publishConfig": { | ||
"tag": "next" | ||
}, | ||
"description": "A parser and formatter for delimiter-separated values, such as CSV and TSV", | ||
@@ -5,0 +8,0 @@ "keywords": [ |
@@ -48,3 +48,3 @@ # d3-dsv | ||
Equivalent to [dsvFormat](#dsvFormat)(",").[parse](#dsv_parse). | ||
Equivalent to [dsvFormat](#dsvFormat)(",").[parse](#dsv_parse). Note: requires unsafe-eval [content security policy](#content-security-policy). | ||
@@ -77,3 +77,3 @@ <a name="csvParseRows" href="#csvParseRows">#</a> d3.<b>csvParseRows</b>(<i>string</i>[, <i>row</i>]) [<>](https://github.com/d3/d3-dsv/blob/master/src/csv.js "Source") | ||
Equivalent to [dsvFormat](#dsvFormat)("\t").[parse](#dsv_parse). | ||
Equivalent to [dsvFormat](#dsvFormat)("\t").[parse](#dsv_parse). Note: requires unsafe-eval [content security policy](#content-security-policy). | ||
@@ -135,2 +135,4 @@ <a name="tsvParseRows" href="#tsvParseRows">#</a> d3.<b>tsvParseRows</b>(<i>string</i>[, <i>row</i>]) [<>](https://github.com/d3/d3-dsv/blob/master/src/tsv.js "Source") | ||
If the column names are not unique, only the last value is returned for each name; to access all values, use [*dsv*.parseRows](#dsv_parseRows) instead (see [example](https://observablehq.com/@d3/parse-csv-with-duplicate-column-names)). | ||
If a *row* conversion function is not specified, field values are strings. For safety, there is no automatic conversion to numbers, dates, or other types. In some cases, JavaScript may coerce strings to numbers for you automatically (for example, using the `+` operator), but better is to specify a *row* conversion function. See [d3.autoType](#autoType) for a convenient *row* conversion function that infers and coerces common types like numbers and strings. | ||
@@ -153,2 +155,4 @@ | ||
Note: requires unsafe-eval [content security policy](#content-security-policy). | ||
<a name="dsv_parseRows" href="#dsv_parseRows">#</a> <i>dsv</i>.<b>parseRows</b>(<i>string</i>[, <i>row</i>]) [<>](https://github.com/d3/d3-dsv/blob/master/src/dsv.js "Source") | ||
@@ -395,2 +399,7 @@ | ||
<a name="dsv2json_autotype" href="dsv2json_autotype">#</a> dsv2json <b>-a</b> | ||
<br><a href="dsv2json_autotype">#</a> dsv2json <b>--auto-type</b> | ||
Use type inference when parsing rows. See <a href="#autoType">d3.autoType</a> for how it works. | ||
<a name="dsv2json_input_delimiter" href="dsv2json_input_delimiter">#</a> dsv2json <b>-r</b> <i>delimiter</i> | ||
@@ -472,8 +481,8 @@ <br><a href="dsv2json_input_delimiter">#</a> dsv2json <b>--input-delimiter</b> <i>delimiter</i> | ||
<a name="csv2json" href="#csv2json">#</a> <b>csv2json</b> [<i>options…</i>] [<i>file</i>] | ||
<a name="json2csv" href="#json2csv">#</a> <b>json2csv</b> [<i>options…</i>] [<i>file</i>] | ||
Equivalent to [json2dsv](#json2dsv). | ||
<a name="tsv2json" href="#csv2json">#</a> <b>tsv2json</b> [<i>options…</i>] [<i>file</i>] | ||
<a name="json2tsv" href="#json2tsv">#</a> <b>json2tsv</b> [<i>options…</i>] [<i>file</i>] | ||
Equivalent to [json2dsv](#json2dsv), but the [output delimiter](#json2dsv_output_delimiter) defaults to the tab character (\t). |
@@ -20,2 +20,2 @@ export default function autoType(object) { | ||
// https://github.com/d3/d3-dsv/issues/45 | ||
var fixtz = new Date("2019-01-01T00:00").getHours() || new Date("2019-07-01T00:00").getHours(); | ||
const fixtz = new Date("2019-01-01T00:00").getHours() || new Date("2019-07-01T00:00").getHours(); |
Sorry, the diff of this file is not supported yet
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
51341
483
1
1