Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

d3-fetch

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

d3-fetch - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

src/image.js

23

dist/d3-fetch.js

@@ -1,2 +0,2 @@

// https://d3js.org/d3-fetch/ Version 0.0.1. Copyright 2016 Mike Bostock.
// https://d3js.org/d3-fetch/ Version 0.0.2. Copyright 2016 Mike Bostock.
(function (global, factory) {

@@ -16,11 +16,21 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-dsv')) :

var json = function(url) {
var csv = function(url, row) {
return text(url).then(function(response) {
return JSON.parse(response);
return d3Dsv.csvParse(response, row);
});
};
var csv = function(url, row) {
var image = function(url, anonymous) {
return new Promise(function(resolve, reject) {
var image = new Image;
if (anonymous) image.crossOrigin = "anonymous";
image.onerror = reject;
image.onload = function() { resolve(image); };
image.src = url;
});
};
var json = function(url) {
return text(url).then(function(response) {
return d3Dsv.csvParse(response, row);
return JSON.parse(response);
});

@@ -35,5 +45,6 @@ };

exports.csv = csv;
exports.image = image;
exports.json = json;
exports.text = text;
exports.csv = csv;
exports.tsv = tsv;

@@ -40,0 +51,0 @@

@@ -1,2 +0,2 @@

// https://d3js.org/d3-fetch/ Version 0.0.1. Copyright 2016 Mike Bostock.
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("d3-dsv")):"function"==typeof define&&define.amd?define(["exports","d3-dsv"],t):t(e.d3=e.d3||{},e.d3)}(this,function(e,t){"use strict";function n(e){return e.text()}var r=function(e){return fetch(e).then(n)},u=function(e){return r(e).then(function(e){return JSON.parse(e)})},o=function(e,n){return r(e).then(function(e){return t.csvParse(e,n)})},f=function(e,n){return r(e).then(function(e){return t.tsvParse(e,n)})};e.json=u,e.text=r,e.csv=o,e.tsv=f,Object.defineProperty(e,"__esModule",{value:!0})});
// 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})});

@@ -0,4 +1,5 @@

export {default as csv} from "./src/csv";
export {default as image} from "./src/image";
export {default as json} from "./src/json";
export {default as text} from "./src/text";
export {default as csv} from "./src/csv";
export {default as tsv} from "./src/tsv";
{
"name": "d3-fetch",
"version": "0.0.1",
"version": "0.0.2",
"description": "Convenient parsing for Fetch.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -41,3 +41,3 @@ # d3-fetch

<a name="csv" href="#csv">#</a> d3.<b>csv</b>(<i>url</i>[, <i>row</i>])
<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")

@@ -57,11 +57,15 @@ Fetches the [CSV](https://github.com/d3/d3-dsv#csvParse) file at the specified *url*. An optional *row* conversion function may be specified to map and filter row objects to a more-specific representation; see [*dsv*.parse](https://github.com/d3/d3-dsv#dsv_parse) for details. For example:

<a name="json" href="#json">#</a> d3.<b>json</b>(<i>url</i>)
<a name="image" href="#image">#</a> d3.<b>image</b>(<i>url</i>[, <i>anonymous</i>]) [<>](https://github.com/d3/d3-fetch/blob/master/src/image.js "Source")
Fetches the image at the specified *url*. If *anonymous* is true, the [cross-origin request](https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image) is anonymous.
<a name="json" href="#json">#</a> d3.<b>json</b>(<i>url</i>) [<>](https://github.com/d3/d3-fetch/blob/master/src/json.js "Source")
Fetches the [JSON](http://json.org) file at the specified *url*.
<a name="text" href="#text">#</a> d3.<b>text</b>(<i>url</i>)
<a name="text" href="#text">#</a> d3.<b>text</b>(<i>url</i>) [<>](https://github.com/d3/d3-fetch/blob/master/src/text.js "Source")
Fetches the text file at the specified *url*.
<a name="tsv" href="#tsv">#</a> d3.<b>tsv</b>(<i>url</i>[, <i>row</i>])
<a name="tsv" href="#tsv">#</a> d3.<b>tsv</b>(<i>url</i>[, <i>row</i>]) [<>](https://github.com/d3/d3-fetch/blob/master/src/tsv.js "Source")

@@ -68,0 +72,0 @@ Fetches the [TSV](https://github.com/d3/d3-dsv#tsvParse) file at the specified *url*. An optional *row* conversion function may be specified to map and filter row objects to a more-specific representation; see [*dsv*.parse](https://github.com/d3/d3-dsv#dsv_parse) for details. For example:

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc