vega-datasets
Advanced tools
Comparing version 2.5.2 to 2.5.3--canary.395.5228498.0
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('d3-dsv')) : | ||
typeof define === 'function' && define.amd ? define(['d3-dsv'], factory) : | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.vegaDatasets = factory(global.d3)); | ||
})(this, (function (d3) { 'use strict'; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : | ||
typeof define === 'function' && define.amd ? define(factory) : | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.vegaDatasets = factory()); | ||
})(this, (function () { 'use strict'; | ||
function _interopNamespace(e) { | ||
if (e && e.__esModule) return e; | ||
var n = Object.create(null); | ||
if (e) { | ||
Object.keys(e).forEach(function (k) { | ||
if (k !== 'default') { | ||
var d = Object.getOwnPropertyDescriptor(e, k); | ||
Object.defineProperty(n, k, d.get ? d : { | ||
enumerable: true, | ||
get: function () { return e[k]; } | ||
}); | ||
var EOL = {}, | ||
EOF = {}, | ||
QUOTE = 34, | ||
NEWLINE = 10, | ||
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; | ||
} | ||
function pad(value, width) { | ||
var s = value + "", | ||
length = s.length; | ||
return length < width ? new Array(width - length + 1).join(0) + s : s; | ||
} | ||
function formatYear(year) { | ||
return year < 0 ? "-" + pad(-year, 6) : year > 9999 ? "+" + pad(year, 6) : pad(year, 4); | ||
} | ||
function formatDate(date) { | ||
var hours = date.getUTCHours(), | ||
minutes = date.getUTCMinutes(), | ||
seconds = date.getUTCSeconds(), | ||
milliseconds = date.getUTCMilliseconds(); | ||
return isNaN(date) ? "Invalid Date" : formatYear(date.getUTCFullYear()) + "-" + pad(date.getUTCMonth() + 1, 2) + "-" + pad(date.getUTCDate(), 2) + (milliseconds ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + ":" + pad(seconds, 2) + "." + pad(milliseconds, 3) + "Z" : seconds ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + ":" + pad(seconds, 2) + "Z" : minutes || hours ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + "Z" : ""); | ||
} | ||
function dsv (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; | ||
} | ||
n["default"] = e; | ||
return Object.freeze(n); | ||
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 preformatBody(rows, columns) { | ||
return rows.map(function (row) { | ||
return columns.map(function (column) { | ||
return formatValue(row[column]); | ||
}).join(delimiter); | ||
}); | ||
} | ||
function format(rows, columns) { | ||
if (columns == null) columns = inferColumns(rows); | ||
return [columns.map(formatValue).join(delimiter)].concat(preformatBody(rows, columns)).join("\n"); | ||
} | ||
function formatBody(rows, columns) { | ||
if (columns == null) columns = inferColumns(rows); | ||
return preformatBody(rows, columns).join("\n"); | ||
} | ||
function formatRows(rows) { | ||
return rows.map(formatRow).join("\n"); | ||
} | ||
function formatRow(row) { | ||
return row.map(formatValue).join(delimiter); | ||
} | ||
function formatValue(value) { | ||
return value == null ? "" : value instanceof Date ? formatDate(value) : reFormat.test(value += "") ? "\"" + value.replace(/"/g, "\"\"") + "\"" : value; | ||
} | ||
return { | ||
parse: parse, | ||
parseRows: parseRows, | ||
format: format, | ||
formatBody: formatBody, | ||
formatRows: formatRows, | ||
formatRow: formatRow, | ||
formatValue: formatValue | ||
}; | ||
} | ||
var d3__namespace = /*#__PURE__*/_interopNamespace(d3); | ||
var csv = dsv(","); | ||
var csvParse = csv.parse; | ||
var version = "2.5.1"; | ||
function autoType(object) { | ||
for (var key in object) { | ||
var value = object[key].trim(), | ||
number, | ||
m; | ||
if (!value) value = null;else if (value === "true") value = true;else if (value === "false") value = false;else if (value === "NaN") value = NaN;else if (!isNaN(number = +value)) value = number;else if (m = value.match(/^([-+]\d{2})?\d{4}(-\d{2}(-\d{2})?)?(T\d{2}:\d{2}(:\d{2}(\.\d{3})?)?(Z|[-+]\d{2}:\d{2})?)?$/)) { | ||
if (fixtz && !!m[4] && !m[7]) value = value.replace(/-/g, "/").replace(/T/, " "); | ||
value = new Date(value); | ||
} else continue; | ||
object[key] = value; | ||
} | ||
return object; | ||
} // https://github.com/d3/d3-dsv/issues/45 | ||
const fixtz = new Date("2019-01-01T00:00").getHours() || new Date("2019-07-01T00:00").getHours(); | ||
var version = "2.3.1"; | ||
var urls = { | ||
@@ -114,3 +282,3 @@ 'annual-precip.json': `https://cdn.jsdelivr.net/npm/vega-datasets@${version}/data/annual-precip.json`, | ||
} else if (name.endsWith(".csv")) { | ||
return d3__namespace.csvParse(await result.text(), d3__namespace.autoType); | ||
return csvParse(await result.text(), autoType); | ||
} else { | ||
@@ -117,0 +285,0 @@ return await result.text(); |
@@ -1,2 +0,2 @@ | ||
!function(t,s){"object"==typeof exports&&"undefined"!=typeof module?module.exports=s(require("d3-dsv")):"function"==typeof define&&define.amd?define(["d3-dsv"],s):(t="undefined"!=typeof globalThis?globalThis:t||self).vegaDatasets=s(t.d3)}(this,(function(t){"use strict";function s(t){if(t&&t.__esModule)return t;var s=Object.create(null);return t&&Object.keys(t).forEach((function(e){if("default"!==e){var a=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(s,e,a.get?a:{enumerable:!0,get:function(){return t[e]}})}})),s.default=t,Object.freeze(s)}var e=s(t),a="2.5.1",n={"annual-precip.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/annual-precip.json","anscombe.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/anscombe.json","barley.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/barley.json","budget.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/budget.json","budgets.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/budgets.json","burtin.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/burtin.json","cars.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/cars.json","countries.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/countries.json","crimea.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/crimea.json","driving.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/driving.json","earthquakes.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/earthquakes.json","flare-dependencies.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/flare-dependencies.json","flare.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/flare.json","flights-10k.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/flights-10k.json","flights-200k.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/flights-200k.json","flights-20k.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/flights-20k.json","flights-2k.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/flights-2k.json","flights-5k.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/flights-5k.json","football.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/football.json","gapminder.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/gapminder.json","income.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/income.json","jobs.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/jobs.json","londonBoroughs.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/londonBoroughs.json","londonCentroids.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/londonCentroids.json","londonTubeLines.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/londonTubeLines.json","miserables.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/miserables.json","monarchs.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/monarchs.json","movies.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/movies.json","normal-2d.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/normal-2d.json","obesity.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/obesity.json","ohlc.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/ohlc.json","penguins.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/penguins.json","platformer-terrain.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/platformer-terrain.json","points.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/points.json","political-contributions.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/political-contributions.json","population.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/population.json","udistrict.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/udistrict.json","unemployment-across-industries.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/unemployment-across-industries.json","uniform-2d.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/uniform-2d.json","us-10m.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/us-10m.json","us-state-capitals.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/us-state-capitals.json","volcano.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/volcano.json","weather.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/weather.json","wheat.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/wheat.json","world-110m.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/world-110m.json","airports.csv":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/airports.csv","birdstrikes.csv":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/birdstrikes.csv","co2-concentration.csv":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/co2-concentration.csv","disasters.csv":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/disasters.csv","flights-3m.csv":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/flights-3m.csv","flights-airport.csv":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/flights-airport.csv","gapminder-health-income.csv":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/gapminder-health-income.csv","github.csv":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/github.csv","iowa-electricity.csv":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/iowa-electricity.csv","la-riots.csv":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/la-riots.csv","lookup_groups.csv":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/lookup_groups.csv","lookup_people.csv":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/lookup_people.csv","population_engineers_hurricanes.csv":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/population_engineers_hurricanes.csv","seattle-weather-hourly-normals.csv":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/seattle-weather-hourly-normals.csv","seattle-weather.csv":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/seattle-weather.csv","sp500-2000.csv":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/sp500-2000.csv","sp500.csv":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/sp500.csv","stocks.csv":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/stocks.csv","us-employment.csv":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/us-employment.csv","weather.csv":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/weather.csv","windvectors.csv":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/windvectors.csv","zipcodes.csv":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/zipcodes.csv","unemployment.tsv":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/unemployment.tsv","flights-200k.arrow":"https://cdn.jsdelivr.net/npm/vega-datasets@2.5.1/data/flights-200k.arrow"};const d={version:a};for(const t of Object.keys(n)){const s=n[t],a=async function(){const a=await fetch(s);return t.endsWith(".json")?await a.json():t.endsWith(".csv")?e.csvParse(await a.text(),e.autoType):await a.text()};a.url=s,d[t]=a}return d})); | ||
!function(t,s){"object"==typeof exports&&"undefined"!=typeof module?module.exports=s():"function"==typeof define&&define.amd?define(s):(t="undefined"!=typeof globalThis?globalThis:t||self).vegaDatasets=s()}(this,(function(){"use strict";var t={},s={};function e(t){return new Function("d","return {"+t.map((function(t,s){return JSON.stringify(t)+": d["+s+'] || ""'})).join(",")+"}")}function n(t){var s=Object.create(null),e=[];return t.forEach((function(t){for(var n in t)n in s||e.push(s[n]=n)})),e}function a(t,s){var e=t+"",n=e.length;return n<s?new Array(s-n+1).join(0)+e:e}function d(t){var s,e=t.getUTCHours(),n=t.getUTCMinutes(),d=t.getUTCSeconds(),o=t.getUTCMilliseconds();return isNaN(t)?"Invalid Date":((s=t.getUTCFullYear())<0?"-"+a(-s,6):s>9999?"+"+a(s,6):a(s,4))+"-"+a(t.getUTCMonth()+1,2)+"-"+a(t.getUTCDate(),2)+(o?"T"+a(e,2)+":"+a(n,2)+":"+a(d,2)+"."+a(o,3)+"Z":d?"T"+a(e,2)+":"+a(n,2)+":"+a(d,2)+"Z":n||e?"T"+a(e,2)+":"+a(n,2)+"Z":"")}var o=function(a){var o=new RegExp('["'+a+"\n\r]"),r=a.charCodeAt(0);function i(e,n){var a,d=[],o=e.length,i=0,c=0,p=o<=0,v=!1;function l(){if(p)return s;if(v)return v=!1,t;var n,a,d=i;if(34===e.charCodeAt(d)){for(;i++<o&&34!==e.charCodeAt(i)||34===e.charCodeAt(++i););return(n=i)>=o?p=!0:10===(a=e.charCodeAt(i++))?v=!0:13===a&&(v=!0,10===e.charCodeAt(i)&&++i),e.slice(d+1,n-1).replace(/""/g,'"')}for(;i<o;){if(10===(a=e.charCodeAt(n=i++)))v=!0;else if(13===a)v=!0,10===e.charCodeAt(i)&&++i;else if(a!==r)continue;return e.slice(d,n)}return p=!0,e.slice(d,o)}for(10===e.charCodeAt(o-1)&&--o,13===e.charCodeAt(o-1)&&--o;(a=l())!==s;){for(var j=[];a!==t&&a!==s;)j.push(a),a=l();n&&null==(j=n(j,c++))||d.push(j)}return d}function c(t,s){return t.map((function(t){return s.map((function(s){return v(t[s])})).join(a)}))}function p(t){return t.map(v).join(a)}function v(t){return null==t?"":t instanceof Date?d(t):o.test(t+="")?'"'+t.replace(/"/g,'""')+'"':t}return{parse:function(t,s){var n,a,d=i(t,(function(t,d){if(n)return n(t,d-1);a=t,n=s?function(t,s){var n=e(t);return function(e,a){return s(n(e),a,t)}}(t,s):e(t)}));return d.columns=a||[],d},parseRows:i,format:function(t,s){return null==s&&(s=n(t)),[s.map(v).join(a)].concat(c(t,s)).join("\n")},formatBody:function(t,s){return null==s&&(s=n(t)),c(t,s).join("\n")},formatRows:function(t){return t.map(p).join("\n")},formatRow:p,formatValue:v}}(",").parse;function r(t){for(var s in t){var e,n,a=t[s].trim();if(a)if("true"===a)a=!0;else if("false"===a)a=!1;else if("NaN"===a)a=NaN;else if(isNaN(e=+a)){if(!(n=a.match(/^([-+]\d{2})?\d{4}(-\d{2}(-\d{2})?)?(T\d{2}:\d{2}(:\d{2}(\.\d{3})?)?(Z|[-+]\d{2}:\d{2})?)?$/)))continue;i&&n[4]&&!n[7]&&(a=a.replace(/-/g,"/").replace(/T/," ")),a=new Date(a)}else a=e;else a=null;t[s]=a}return t}const i=new Date("2019-01-01T00:00").getHours()||new Date("2019-07-01T00:00").getHours();var c="2.3.1",p={"annual-precip.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/annual-precip.json","anscombe.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/anscombe.json","barley.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/barley.json","budget.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/budget.json","budgets.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/budgets.json","burtin.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/burtin.json","cars.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/cars.json","countries.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/countries.json","crimea.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/crimea.json","driving.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/driving.json","earthquakes.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/earthquakes.json","flare-dependencies.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/flare-dependencies.json","flare.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/flare.json","flights-10k.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/flights-10k.json","flights-200k.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/flights-200k.json","flights-20k.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/flights-20k.json","flights-2k.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/flights-2k.json","flights-5k.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/flights-5k.json","football.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/football.json","gapminder.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/gapminder.json","income.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/income.json","jobs.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/jobs.json","londonBoroughs.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/londonBoroughs.json","londonCentroids.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/londonCentroids.json","londonTubeLines.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/londonTubeLines.json","miserables.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/miserables.json","monarchs.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/monarchs.json","movies.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/movies.json","normal-2d.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/normal-2d.json","obesity.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/obesity.json","ohlc.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/ohlc.json","penguins.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/penguins.json","platformer-terrain.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/platformer-terrain.json","points.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/points.json","political-contributions.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/political-contributions.json","population.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/population.json","udistrict.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/udistrict.json","unemployment-across-industries.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/unemployment-across-industries.json","uniform-2d.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/uniform-2d.json","us-10m.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/us-10m.json","us-state-capitals.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/us-state-capitals.json","volcano.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/volcano.json","weather.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/weather.json","wheat.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/wheat.json","world-110m.json":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/world-110m.json","airports.csv":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/airports.csv","birdstrikes.csv":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/birdstrikes.csv","co2-concentration.csv":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/co2-concentration.csv","disasters.csv":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/disasters.csv","flights-3m.csv":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/flights-3m.csv","flights-airport.csv":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/flights-airport.csv","gapminder-health-income.csv":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/gapminder-health-income.csv","github.csv":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/github.csv","iowa-electricity.csv":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/iowa-electricity.csv","la-riots.csv":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/la-riots.csv","lookup_groups.csv":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/lookup_groups.csv","lookup_people.csv":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/lookup_people.csv","population_engineers_hurricanes.csv":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/population_engineers_hurricanes.csv","seattle-weather-hourly-normals.csv":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/seattle-weather-hourly-normals.csv","seattle-weather.csv":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/seattle-weather.csv","sp500-2000.csv":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/sp500-2000.csv","sp500.csv":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/sp500.csv","stocks.csv":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/stocks.csv","us-employment.csv":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/us-employment.csv","weather.csv":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/weather.csv","windvectors.csv":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/windvectors.csv","zipcodes.csv":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/zipcodes.csv","unemployment.tsv":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/unemployment.tsv","flights-200k.arrow":"https://cdn.jsdelivr.net/npm/vega-datasets@2.3.1/data/flights-200k.arrow"};const v={version:c};for(const t of Object.keys(p)){const s=p[t],e=async function(){const e=await fetch(s);return t.endsWith(".json")?await e.json():t.endsWith(".csv")?o(await e.text(),r):await e.text()};e.url=s,v[t]=e}return v})); | ||
//# sourceMappingURL=vega-datasets.min.js.map |
@@ -1,3 +0,1 @@ | ||
import * as d3 from 'd3-dsv'; | ||
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { | ||
@@ -725,4 +723,230 @@ try { | ||
var version = "2.5.1"; | ||
var EOL = {}, | ||
EOF = {}, | ||
QUOTE = 34, | ||
NEWLINE = 10, | ||
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; | ||
} | ||
function pad(value, width) { | ||
var s = value + "", | ||
length = s.length; | ||
return length < width ? new Array(width - length + 1).join(0) + s : s; | ||
} | ||
function formatYear(year) { | ||
return year < 0 ? "-" + pad(-year, 6) : year > 9999 ? "+" + pad(year, 6) : pad(year, 4); | ||
} | ||
function formatDate(date) { | ||
var hours = date.getUTCHours(), | ||
minutes = date.getUTCMinutes(), | ||
seconds = date.getUTCSeconds(), | ||
milliseconds = date.getUTCMilliseconds(); | ||
return isNaN(date) ? "Invalid Date" : formatYear(date.getUTCFullYear()) + "-" + pad(date.getUTCMonth() + 1, 2) + "-" + pad(date.getUTCDate(), 2) + (milliseconds ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + ":" + pad(seconds, 2) + "." + pad(milliseconds, 3) + "Z" : seconds ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + ":" + pad(seconds, 2) + "Z" : minutes || hours ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + "Z" : ""); | ||
} | ||
function dsv (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 preformatBody(rows, columns) { | ||
return rows.map(function (row) { | ||
return columns.map(function (column) { | ||
return formatValue(row[column]); | ||
}).join(delimiter); | ||
}); | ||
} | ||
function format(rows, columns) { | ||
if (columns == null) columns = inferColumns(rows); | ||
return [columns.map(formatValue).join(delimiter)].concat(preformatBody(rows, columns)).join("\n"); | ||
} | ||
function formatBody(rows, columns) { | ||
if (columns == null) columns = inferColumns(rows); | ||
return preformatBody(rows, columns).join("\n"); | ||
} | ||
function formatRows(rows) { | ||
return rows.map(formatRow).join("\n"); | ||
} | ||
function formatRow(row) { | ||
return row.map(formatValue).join(delimiter); | ||
} | ||
function formatValue(value) { | ||
return value == null ? "" : value instanceof Date ? formatDate(value) : reFormat.test(value += "") ? "\"" + value.replace(/"/g, "\"\"") + "\"" : value; | ||
} | ||
return { | ||
parse: parse, | ||
parseRows: parseRows, | ||
format: format, | ||
formatBody: formatBody, | ||
formatRows: formatRows, | ||
formatRow: formatRow, | ||
formatValue: formatValue | ||
}; | ||
} | ||
var csv = dsv(","); | ||
var csvParse = csv.parse; | ||
var csvParseRows = csv.parseRows; | ||
var csvFormat = csv.format; | ||
var csvFormatBody = csv.formatBody; | ||
var csvFormatRows = csv.formatRows; | ||
var csvFormatRow = csv.formatRow; | ||
var csvFormatValue = csv.formatValue; | ||
var tsv = dsv("\t"); | ||
var tsvParse = tsv.parse; | ||
var tsvParseRows = tsv.parseRows; | ||
var tsvFormat = tsv.format; | ||
var tsvFormatBody = tsv.formatBody; | ||
var tsvFormatRows = tsv.formatRows; | ||
var tsvFormatRow = tsv.formatRow; | ||
var tsvFormatValue = tsv.formatValue; | ||
function autoType(object) { | ||
for (var key in object) { | ||
var value = object[key].trim(), | ||
number, | ||
m; | ||
if (!value) value = null;else if (value === "true") value = true;else if (value === "false") value = false;else if (value === "NaN") value = NaN;else if (!isNaN(number = +value)) value = number;else if (m = value.match(/^([-+]\d{2})?\d{4}(-\d{2}(-\d{2})?)?(T\d{2}:\d{2}(:\d{2}(\.\d{3})?)?(Z|[-+]\d{2}:\d{2})?)?$/)) { | ||
if (fixtz && !!m[4] && !m[7]) value = value.replace(/-/g, "/").replace(/T/, " "); | ||
value = new Date(value); | ||
} else continue; | ||
object[key] = value; | ||
} | ||
return 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(); | ||
var d3 = /*#__PURE__*/Object.freeze({ | ||
__proto__: null, | ||
dsvFormat: dsv, | ||
csvParse: csvParse, | ||
csvParseRows: csvParseRows, | ||
csvFormat: csvFormat, | ||
csvFormatBody: csvFormatBody, | ||
csvFormatRows: csvFormatRows, | ||
csvFormatRow: csvFormatRow, | ||
csvFormatValue: csvFormatValue, | ||
tsvParse: tsvParse, | ||
tsvParseRows: tsvParseRows, | ||
tsvFormat: tsvFormat, | ||
tsvFormatBody: tsvFormatBody, | ||
tsvFormatRows: tsvFormatRows, | ||
tsvFormatRow: tsvFormatRow, | ||
tsvFormatValue: tsvFormatValue, | ||
autoType: autoType | ||
}); | ||
var version = "2.3.1"; | ||
var urls = { | ||
@@ -844,3 +1068,3 @@ 'annual-precip.json': "https://cdn.jsdelivr.net/npm/vega-datasets@".concat(version, "/data/annual-precip.json"), | ||
_context.t1 = _context.sent; | ||
_context.t2 = d3.autoType; | ||
_context.t2 = autoType; | ||
return _context.abrupt("return", _context.t0.csvParse.call(_context.t0, _context.t1, _context.t2)); | ||
@@ -847,0 +1071,0 @@ |
{ | ||
"name": "vega-datasets", | ||
"version": "2.5.2", | ||
"version": "2.5.3--canary.395.5228498.0", | ||
"description": "Common repository for example datasets used by Vega related projects.", | ||
@@ -33,2 +33,3 @@ "license": "BSD-3-Clause", | ||
"@rollup/plugin-json": "^4.1.0", | ||
"@rollup/plugin-node-resolve": "^14.1.0", | ||
"@types/d3-dsv": "^3.0.0", | ||
@@ -35,0 +36,0 @@ "auto": "^10.37.6", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
35305235
241501
19