Comparing version 0.0.2 to 0.1.0
@@ -1,8 +0,24 @@ | ||
// https://d3js.org/d3-fetch/ Version 0.0.2. Copyright 2016 Mike Bostock. | ||
// https://d3js.org/d3-fetch/ Version 0.1.0. Copyright 2017 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)); | ||
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'; | ||
function responseBlob(response) { | ||
return response.blob(); | ||
} | ||
var blob = function(url) { | ||
return fetch(url).then(responseBlob); | ||
}; | ||
function responseArrayBuffer(response) { | ||
return response.arrayBuffer(); | ||
} | ||
var buffer = function(url) { | ||
return fetch(url).then(responseArrayBuffer); | ||
}; | ||
function responseText(response) { | ||
@@ -32,6 +48,8 @@ return response.text(); | ||
function responseJson(response) { | ||
return response.json(); | ||
} | ||
var json = function(url) { | ||
return text(url).then(function(response) { | ||
return JSON.parse(response); | ||
}); | ||
return fetch(url).then(responseJson); | ||
}; | ||
@@ -45,2 +63,4 @@ | ||
exports.blob = blob; | ||
exports.buffer = buffer; | ||
exports.csv = csv; | ||
@@ -47,0 +67,0 @@ exports.image = image; |
@@ -1,2 +0,2 @@ | ||
// https://d3js.org/d3-fetch/ Version 0.0.2. Copyright 2016 Mike Bostock. | ||
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("d3-dsv")):"function"==typeof define&&define.amd?define(["exports","d3-dsv"],e):e(n.d3=n.d3||{},n.d3)}(this,function(n,e){"use strict";function t(n){return n.text()}var r=function(n){return fetch(n).then(t)},o=function(n,t){return r(n).then(function(n){return e.csvParse(n,t)})},u=function(n,e){return new Promise(function(t,r){var o=new Image;e&&(o.crossOrigin="anonymous"),o.onerror=r,o.onload=function(){t(o)},o.src=n})},i=function(n){return r(n).then(function(n){return JSON.parse(n)})},f=function(n,t){return r(n).then(function(n){return e.tsvParse(n,t)})};n.csv=o,n.image=u,n.json=i,n.text=r,n.tsv=f,Object.defineProperty(n,"__esModule",{value:!0})}); | ||
// https://d3js.org/d3-fetch/ Version 0.1.0. Copyright 2017 Mike Bostock. | ||
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("d3-dsv")):"function"==typeof define&&define.amd?define(["exports","d3-dsv"],e):e(n.d3=n.d3||{},n.d3)}(this,function(n,e){"use strict";function t(n){return n.blob()}function r(n){return n.arrayBuffer()}function o(n){return n.text()}function u(n){return n.json()}var f=function(n){return fetch(n).then(o)};n.blob=function(n){return fetch(n).then(t)},n.buffer=function(n){return fetch(n).then(r)},n.csv=function(n,t){return f(n).then(function(n){return e.csvParse(n,t)})},n.image=function(n,e){return new Promise(function(t,r){var o=new Image;e&&(o.crossOrigin="anonymous"),o.onerror=r,o.onload=function(){t(o)},o.src=n})},n.json=function(n){return fetch(n).then(u)},n.text=f,n.tsv=function(n,t){return f(n).then(function(n){return e.tsvParse(n,t)})},Object.defineProperty(n,"__esModule",{value:!0})}); |
@@ -0,1 +1,3 @@ | ||
export {default as blob} from "./src/blob"; | ||
export {default as buffer} from "./src/buffer"; | ||
export {default as csv} from "./src/csv"; | ||
@@ -2,0 +4,0 @@ export {default as image} from "./src/image"; |
{ | ||
"name": "d3-fetch", | ||
"version": "0.0.2", | ||
"version": "0.1.0", | ||
"description": "Convenient parsing for Fetch.", | ||
@@ -25,6 +25,6 @@ "keywords": [ | ||
"scripts": { | ||
"pretest": "rm -rf dist && mkdir dist && rollup --banner \"$(preamble)\" -f umd -g d3-dsv:d3 -n d3 -o dist/d3-fetch.js -- index.js", | ||
"pretest": "rm -rf dist && mkdir dist && rollup -c --banner \"$(preamble)\"", | ||
"test": "tape 'test/**/*-test.js'", | ||
"prepublish": "npm run test && uglifyjs --preamble \"$(preamble)\" dist/d3-fetch.js -c -m -o dist/d3-fetch.min.js", | ||
"postpublish": "VERSION=`node -e 'console.log(require(\"./package.json\").version)'`; git push && git push --tags && cd ../d3.github.com && git pull && cp ../d3-fetch/dist/d3-fetch.js d3-fetch.v0.js && cp ../d3-fetch/dist/d3-fetch.min.js d3-fetch.v0.min.js && git add d3-fetch.v0.js d3-fetch.v0.min.js && git commit -m \"d3-fetch ${VERSION}\" && git push && cd - && zip -j dist/d3-fetch.zip -- LICENSE README.md dist/d3-fetch.js dist/d3-fetch.min.js" | ||
"prepublishOnly": "npm run test && uglifyjs -b beautify=false,preamble=\"'$(preamble)'\" dist/d3-fetch.js -c -m -o dist/d3-fetch.min.js", | ||
"postpublish": "git push && git push --tags && cd ../d3.github.com && git pull && cp ../d3-fetch/dist/d3-fetch.js d3-fetch.v0.js && cp ../d3-fetch/dist/d3-fetch.min.js d3-fetch.v0.min.js && git add d3-fetch.v0.js d3-fetch.v0.min.js && git commit -m \"d3-fetch ${npm_package_version}\" && git push && cd - && zip -j dist/d3-fetch.zip -- LICENSE README.md dist/d3-fetch.js dist/d3-fetch.min.js" | ||
}, | ||
@@ -35,8 +35,8 @@ "dependencies": { | ||
"devDependencies": { | ||
"eslint": "3", | ||
"package-preamble": "0.0", | ||
"rollup": "0.36", | ||
"eslint": "4", | ||
"package-preamble": "0.1", | ||
"rollup": "0.52", | ||
"tape": "4", | ||
"uglify-js": "2" | ||
"uglify-js": "3" | ||
} | ||
} |
@@ -41,2 +41,10 @@ # d3-fetch | ||
<a name="blob" href="#blob">#</a> d3.<b>blob</b>(<i>url</i>) [<>](https://github.com/d3/d3-fetch/blob/master/src/blob.js "Source") | ||
Fetches the binary file at the specified *url* as a Blob. | ||
<a name="buffer" href="#buffer">#</a> d3.<b>buffer</b>(<i>url</i>) [<>](https://github.com/d3/d3-fetch/blob/master/src/buffer.js "Source") | ||
Fetches the binary file at the specified *url* as an ArrayBuffer. | ||
<a name="csv" href="#csv">#</a> d3.<b>csv</b>(<i>url</i>[, <i>row</i>]) [<>](https://github.com/d3/d3-fetch/blob/master/src/csv.js "Source") | ||
@@ -43,0 +51,0 @@ |
@@ -1,7 +0,7 @@ | ||
import text from "./text"; | ||
function responseJson(response) { | ||
return response.json(); | ||
} | ||
export default function(url) { | ||
return text(url).then(function(response) { | ||
return JSON.parse(response); | ||
}); | ||
return fetch(url).then(responseJson); | ||
} |
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
11168
15
126
90
12