Comparing version 1.1.2 to 1.2.0
@@ -1,7 +0,7 @@ | ||
// https://d3js.org/d3-fetch/ v1.1.2 Copyright 2018 Mike Bostock | ||
// https://d3js.org/d3-fetch/ v1.2.0 Copyright 2020 Mike Bostock | ||
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-dsv')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'd3-dsv'], factory) : | ||
(factory((global.d3 = global.d3 || {}),global.d3)); | ||
}(this, (function (exports,d3Dsv) { 'use strict'; | ||
(global = global || self, factory(global.d3 = global.d3 || {}, global.d3)); | ||
}(this, function (exports, d3Dsv) { 'use strict'; | ||
@@ -67,2 +67,3 @@ function responseBlob(response) { | ||
if (!response.ok) throw new Error(response.status + " " + response.statusText); | ||
if (response.status === 204 || response.status === 205) return; | ||
return response.json(); | ||
@@ -77,4 +78,4 @@ } | ||
return function(input, init) { | ||
return text(input, init).then(function(text$$1) { | ||
return (new DOMParser).parseFromString(text$$1, type); | ||
return text(input, init).then(function(text) { | ||
return (new DOMParser).parseFromString(text, type); | ||
}); | ||
@@ -92,14 +93,14 @@ }; | ||
exports.buffer = buffer; | ||
exports.csv = csv; | ||
exports.dsv = dsv; | ||
exports.csv = csv; | ||
exports.tsv = tsv; | ||
exports.html = html; | ||
exports.image = image; | ||
exports.json = json; | ||
exports.svg = svg; | ||
exports.text = text; | ||
exports.tsv = tsv; | ||
exports.xml = xml; | ||
exports.html = html; | ||
exports.svg = svg; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
}))); | ||
})); |
@@ -1,2 +0,2 @@ | ||
// 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})}); | ||
// https://d3js.org/d3-fetch/ v1.2.0 Copyright 2020 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=t||self).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 s=f(n.csvParse),i=f(n.tsvParse);function c(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);if(204!==t.status&&205!==t.status)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.csv=s,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.html=h,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.svg=v,t.text=u,t.tsv=i,t.xml=d,Object.defineProperty(t,"__esModule",{value:!0})}); |
{ | ||
"name": "d3-fetch", | ||
"version": "1.1.2", | ||
"version": "1.2.0", | ||
"description": "Convenient parsing for Fetch.", | ||
@@ -26,2 +26,6 @@ "keywords": [ | ||
}, | ||
"files": [ | ||
"dist/**/*.js", | ||
"src/**/*.js" | ||
], | ||
"scripts": { | ||
@@ -36,8 +40,9 @@ "pretest": "rollup -c", | ||
}, | ||
"sideEffects": false, | ||
"devDependencies": { | ||
"eslint": "5", | ||
"rollup": "0.64", | ||
"rollup-plugin-terser": "1", | ||
"eslint": "6", | ||
"rollup": "1", | ||
"rollup-plugin-terser": "5", | ||
"tape": "4" | ||
} | ||
} |
@@ -88,3 +88,3 @@ # d3-fetch | ||
Fetches the [JSON](http://json.org) file at the specified *input* URL. If *init* is specified, it is passed along to the underlying call to [fetch](https://fetch.spec.whatwg.org/#fetch-method); see [RequestInit](https://fetch.spec.whatwg.org/#requestinit) for allowed fields. | ||
Fetches the [JSON](http://json.org) file at the specified *input* URL. If *init* is specified, it is passed along to the underlying call to [fetch](https://fetch.spec.whatwg.org/#fetch-method); see [RequestInit](https://fetch.spec.whatwg.org/#requestinit) for allowed fields. If the server returns a status code of [204 No Content](https://developer.mozilla.org/docs/Web/HTTP/Status/204) or [205 Reset Content](https://developer.mozilla.org/docs/Web/HTTP/Status/205), the promise resolves to `undefined`. | ||
@@ -91,0 +91,0 @@ <a name="svg" href="#svg">#</a> d3.<b>svg</b>(<i>input</i>[, <i>init</i>]) [<>](https://github.com/d3/d3-fetch/blob/master/src/xml.js "Source") |
import {csvParse, dsvFormat, tsvParse} from "d3-dsv"; | ||
import text from "./text"; | ||
import text from "./text.js"; | ||
@@ -4,0 +4,0 @@ function dsvParse(parse) { |
@@ -1,7 +0,7 @@ | ||
export {default as blob} from "./blob"; | ||
export {default as buffer} from "./buffer"; | ||
export {default as dsv, csv, tsv} from "./dsv"; | ||
export {default as image} from "./image"; | ||
export {default as json} from "./json"; | ||
export {default as text} from "./text"; | ||
export {default as xml, html, svg} from "./xml"; | ||
export {default as blob} from "./blob.js"; | ||
export {default as buffer} from "./buffer.js"; | ||
export {default as dsv, csv, tsv} from "./dsv.js"; | ||
export {default as image} from "./image.js"; | ||
export {default as json} from "./json.js"; | ||
export {default as text} from "./text.js"; | ||
export {default as xml, html, svg} from "./xml.js"; |
function responseJson(response) { | ||
if (!response.ok) throw new Error(response.status + " " + response.statusText); | ||
if (response.status === 204 || response.status === 205) return; | ||
return response.json(); | ||
@@ -4,0 +5,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import text from "./text"; | ||
import text from "./text.js"; | ||
@@ -3,0 +3,0 @@ function parser(type) { |
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
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
17027
13
166