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
1.5 KiB

// https://d3js.org/d3-fetch/ v1.1.2 Copyright 2018 Mike Bostock
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("d3-dsv")):"function"==typeof define&&define.amd?define(["exports","d3-dsv"],n):n(t.d3=t.d3||{},t.d3)}(this,function(t,n){"use strict";function e(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.blob()}function r(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.arrayBuffer()}function o(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.text()}function u(t,n){return fetch(t,n).then(o)}function f(t){return function(n,e,r){return 2===arguments.length&&"function"==typeof e&&(r=e,e=void 0),u(n,e).then(function(n){return t(n,r)})}}var i=f(n.csvParse),s=f(n.tsvParse);function c(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.json()}function a(t){return function(n,e){return u(n,e).then(function(n){return(new DOMParser).parseFromString(n,t)})}}var d=a("application/xml"),h=a("text/html"),v=a("image/svg+xml");t.blob=function(t,n){return fetch(t,n).then(e)},t.buffer=function(t,n){return fetch(t,n).then(r)},t.dsv=function(t,e,r,o){3===arguments.length&&"function"==typeof r&&(o=r,r=void 0);var f=n.dsvFormat(t);return u(e,r).then(function(t){return f.parse(t,o)})},t.csv=i,t.tsv=s,t.image=function(t,n){return new Promise(function(e,r){var o=new Image;for(var u in n)o[u]=n[u];o.onerror=r,o.onload=function(){e(o)},o.src=t})},t.json=function(t,n){return fetch(t,n).then(c)},t.text=u,t.xml=d,t.html=h,t.svg=v,Object.defineProperty(t,"__esModule",{value:!0})});