You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
2.0 KiB

// https://d3js.org/d3-dsv/ Version 1.0.8. Copyright 2017 Mike Bostock.
!function(r,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(r.d3=r.d3||{})}(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(",")+"}")}var t={},e={},o=34,u=10,a=13,c=function(r){function c(r,n){function c(){if(m)return e;if(v)return v=!1,t;var n,c,i=d;if(r.charCodeAt(i)===o){for(;d++<s&&r.charCodeAt(d)!==o||r.charCodeAt(++d)===o;);return(n=d)>=s?m=!0:(c=r.charCodeAt(d++))===u?v=!0:c===a&&(v=!0,r.charCodeAt(d)===u&&++d),r.slice(i+1,n-1).replace(/""/g,'"')}for(;d<s;){if((c=r.charCodeAt(n=d++))===u)v=!0;else if(c===a)v=!0,r.charCodeAt(d)===u&&++d;else if(c!==p)continue;return r.slice(i,n)}return m=!0,r.slice(i,s)}var i,f=[],s=r.length,d=0,l=0,m=s<=0,v=!1;for(r.charCodeAt(s-1)===u&&--s,r.charCodeAt(s-1)===a&&--s;(i=c())!==e;){for(var h=[];i!==t&&i!==e;)h.push(i),i=c();n&&null==(h=n(h,l++))||f.push(h)}return f}function i(n){return n.map(f).join(r)}function f(r){return null==r?"":s.test(r+="")?'"'+r.replace(/"/g,'""')+'"':r}var s=new RegExp('["'+r+"\n\r]"),p=r.charCodeAt(0);return{parse:function(r,t){var e,o,u=c(r,function(r,u){if(e)return e(r,u-1);o=r,e=t?function(r,t){var e=n(r);return function(n,o){return t(e(n),o,r)}}(r,t):n(r)});return u.columns=o||[],u},parseRows:c,format:function(n,t){return null==t&&(t=function(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}(n)),[t.map(f).join(r)].concat(n.map(function(n){return t.map(function(r){return f(n[r])}).join(r)})).join("\n")},formatRows:function(r){return r.map(i).join("\n")}}},i=c(","),f=i.parse,s=i.parseRows,p=i.format,d=i.formatRows,l=c("\t"),m=l.parse,v=l.parseRows,h=l.format,w=l.formatRows;r.dsvFormat=c,r.csvParse=f,r.csvParseRows=s,r.csvFormat=p,r.csvFormatRows=d,r.tsvParse=m,r.tsvParseRows=v,r.tsvFormat=h,r.tsvFormatRows=w,Object.defineProperty(r,"__esModule",{value:!0})});