Initial commit
This commit is contained in:
162
node_modules/d3-dsv/build/d3-dsv.js
generated
vendored
Normal file
162
node_modules/d3-dsv/build/d3-dsv.js
generated
vendored
Normal file
@@ -0,0 +1,162 @@
|
||||
// https://d3js.org/d3-dsv/ Version 1.0.8. Copyright 2017 Mike Bostock.
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
||||
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
||||
(factory((global.d3 = global.d3 || {})));
|
||||
}(this, (function (exports) { 'use strict';
|
||||
|
||||
var EOL = {};
|
||||
var EOF = {};
|
||||
var QUOTE = 34;
|
||||
var NEWLINE = 10;
|
||||
var RETURN = 13;
|
||||
|
||||
function objectConverter(columns) {
|
||||
return new Function("d", "return {" + columns.map(function(name, i) {
|
||||
return JSON.stringify(name) + ": d[" + i + "]";
|
||||
}).join(",") + "}");
|
||||
}
|
||||
|
||||
function customConverter(columns, f) {
|
||||
var object = objectConverter(columns);
|
||||
return function(row, i) {
|
||||
return f(object(row), i, columns);
|
||||
};
|
||||
}
|
||||
|
||||
// Compute unique columns in order of discovery.
|
||||
function inferColumns(rows) {
|
||||
var columnSet = Object.create(null),
|
||||
columns = [];
|
||||
|
||||
rows.forEach(function(row) {
|
||||
for (var column in row) {
|
||||
if (!(column in columnSet)) {
|
||||
columns.push(columnSet[column] = column);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return columns;
|
||||
}
|
||||
|
||||
var dsv = function(delimiter) {
|
||||
var reFormat = new RegExp("[\"" + delimiter + "\n\r]"),
|
||||
DELIMITER = delimiter.charCodeAt(0);
|
||||
|
||||
function parse(text, f) {
|
||||
var convert, columns, rows = parseRows(text, function(row, i) {
|
||||
if (convert) return convert(row, i - 1);
|
||||
columns = row, convert = f ? customConverter(row, f) : objectConverter(row);
|
||||
});
|
||||
rows.columns = columns || [];
|
||||
return rows;
|
||||
}
|
||||
|
||||
function parseRows(text, f) {
|
||||
var rows = [], // output rows
|
||||
N = text.length,
|
||||
I = 0, // current character index
|
||||
n = 0, // current line number
|
||||
t, // current token
|
||||
eof = N <= 0, // current token followed by EOF?
|
||||
eol = false; // current token followed by EOL?
|
||||
|
||||
// Strip the trailing newline.
|
||||
if (text.charCodeAt(N - 1) === NEWLINE) --N;
|
||||
if (text.charCodeAt(N - 1) === RETURN) --N;
|
||||
|
||||
function token() {
|
||||
if (eof) return EOF;
|
||||
if (eol) return eol = false, EOL;
|
||||
|
||||
// Unescape quotes.
|
||||
var i, j = I, c;
|
||||
if (text.charCodeAt(j) === QUOTE) {
|
||||
while (I++ < N && text.charCodeAt(I) !== QUOTE || text.charCodeAt(++I) === QUOTE);
|
||||
if ((i = I) >= N) eof = true;
|
||||
else if ((c = text.charCodeAt(I++)) === NEWLINE) eol = true;
|
||||
else if (c === RETURN) { eol = true; if (text.charCodeAt(I) === NEWLINE) ++I; }
|
||||
return text.slice(j + 1, i - 1).replace(/""/g, "\"");
|
||||
}
|
||||
|
||||
// Find next delimiter or newline.
|
||||
while (I < N) {
|
||||
if ((c = text.charCodeAt(i = I++)) === NEWLINE) eol = true;
|
||||
else if (c === RETURN) { eol = true; if (text.charCodeAt(I) === NEWLINE) ++I; }
|
||||
else if (c !== DELIMITER) continue;
|
||||
return text.slice(j, i);
|
||||
}
|
||||
|
||||
// Return last token before EOF.
|
||||
return eof = true, text.slice(j, N);
|
||||
}
|
||||
|
||||
while ((t = token()) !== EOF) {
|
||||
var row = [];
|
||||
while (t !== EOL && t !== EOF) row.push(t), t = token();
|
||||
if (f && (row = f(row, n++)) == null) continue;
|
||||
rows.push(row);
|
||||
}
|
||||
|
||||
return rows;
|
||||
}
|
||||
|
||||
function format(rows, columns) {
|
||||
if (columns == null) columns = inferColumns(rows);
|
||||
return [columns.map(formatValue).join(delimiter)].concat(rows.map(function(row) {
|
||||
return columns.map(function(column) {
|
||||
return formatValue(row[column]);
|
||||
}).join(delimiter);
|
||||
})).join("\n");
|
||||
}
|
||||
|
||||
function formatRows(rows) {
|
||||
return rows.map(formatRow).join("\n");
|
||||
}
|
||||
|
||||
function formatRow(row) {
|
||||
return row.map(formatValue).join(delimiter);
|
||||
}
|
||||
|
||||
function formatValue(text) {
|
||||
return text == null ? ""
|
||||
: reFormat.test(text += "") ? "\"" + text.replace(/"/g, "\"\"") + "\""
|
||||
: text;
|
||||
}
|
||||
|
||||
return {
|
||||
parse: parse,
|
||||
parseRows: parseRows,
|
||||
format: format,
|
||||
formatRows: formatRows
|
||||
};
|
||||
};
|
||||
|
||||
var csv = dsv(",");
|
||||
|
||||
var csvParse = csv.parse;
|
||||
var csvParseRows = csv.parseRows;
|
||||
var csvFormat = csv.format;
|
||||
var csvFormatRows = csv.formatRows;
|
||||
|
||||
var tsv = dsv("\t");
|
||||
|
||||
var tsvParse = tsv.parse;
|
||||
var tsvParseRows = tsv.parseRows;
|
||||
var tsvFormat = tsv.format;
|
||||
var tsvFormatRows = tsv.formatRows;
|
||||
|
||||
exports.dsvFormat = dsv;
|
||||
exports.csvParse = csvParse;
|
||||
exports.csvParseRows = csvParseRows;
|
||||
exports.csvFormat = csvFormat;
|
||||
exports.csvFormatRows = csvFormatRows;
|
||||
exports.tsvParse = tsvParse;
|
||||
exports.tsvParseRows = tsvParseRows;
|
||||
exports.tsvFormat = tsvFormat;
|
||||
exports.tsvFormatRows = tsvFormatRows;
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
})));
|
||||
2
node_modules/d3-dsv/build/d3-dsv.min.js
generated
vendored
Normal file
2
node_modules/d3-dsv/build/d3-dsv.min.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
// 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})});
|
||||
Reference in New Issue
Block a user