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

d3-request

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

d3-request - npm Package Compare versions

Comparing version 0.2.6 to 0.3.0

2

build/bundle.js

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

var version = "0.2.6"; export * from "../index"; export {version};
var version = "0.3.0"; export * from "../index"; export {version};

@@ -188,13 +188,13 @@ (function (global, factory) {

var version = "0.2.6";
var version = "0.3.0";
exports.version = version;
exports.request = request;
exports.html = html;
exports.json = json;
exports.text = text;
exports.xml = xml;
exports.csv = csv;
exports.tsv = tsv;
exports.requestHtml = html;
exports.requestJson = json;
exports.requestText = text;
exports.requestXml = xml;
exports.requestCsv = csv;
exports.requestTsv = tsv;
}));

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

!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("d3-collection"),require("d3-dispatch"),require("d3-dsv")):"function"==typeof define&&define.amd?define("d3-request",["exports","d3-collection","d3-dispatch","d3-dsv"],n):n(e.d3_request={},e.d3_collection,e.d3_dispatch,e.d3_dsv)}(this,function(e,n,t,r){"use strict";function o(e,r){function o(){var e,n=f.status;if(!n&&s(f)||n>=200&&300>n||304===n){if(l)try{e=l.call(i,f)}catch(t){return void p.error.call(i,t)}else e=f;p.load.call(i,e)}else p.error.call(i,f)}var i,a,l,c,p=t.dispatch("beforesend","progress","load","error"),d=n.map(),f=new XMLHttpRequest,m=0;return"undefined"==typeof XDomainRequest||"withCredentials"in f||!/^(http(s)?:)?\/\//.test(e)||(f=new XDomainRequest),"onload"in f?f.onload=f.onerror=f.ontimeout=o:f.onreadystatechange=function(){f.readyState>3&&o()},f.onprogress=function(e){p.progress.call(i,e)},i={header:function(e,n){return e=(e+"").toLowerCase(),arguments.length<2?d.get(e):(null==n?d.remove(e):d.set(e,n+""),i)},mimeType:function(e){return arguments.length?(a=null==e?null:e+"",i):a},responseType:function(e){return arguments.length?(c=e,i):c},timeout:function(e){return arguments.length?(m=+e,i):m},response:function(e){return l=e,i},get:function(e,n){return i.send("GET",e,n)},post:function(e,n){return i.send("POST",e,n)},send:function(n,t,r){return r||"function"!=typeof t||(r=t,t=null),r&&1===r.length&&(r=u(r)),f.open(n,e,!0),null==a||d.has("accept")||d.set("accept",a+",*/*"),f.setRequestHeader&&d.each(function(e,n){f.setRequestHeader(n,e)}),null!=a&&f.overrideMimeType&&f.overrideMimeType(a),null!=c&&(f.responseType=c),m>0&&(f.timeout=m),r&&i.on("error",r).on("load",function(e){r(null,e)}),p.beforesend.call(i,f),f.send(null==t?null:t),i},abort:function(){return f.abort(),i},on:function(){var e=p.on.apply(p,arguments);return e===p?i:e}},r?i.get(r):i}function u(e){return function(n,t){e(null==n?t:null)}}function s(e){var n=e.responseType;return n&&"text"!==n?e.response:e.responseText}function i(e,n){return function(t,r){var u=o(t).mimeType(e).response(n);return r?u.get(r):u}}function a(e,n){return function(t,r,u){arguments.length<3&&(u=r,r=null);var s=o(t).mimeType(e);return s.row=function(e){return arguments.length?s.response(l(n,r=e)):r},s.row(r),u?s.get(u):s}}function l(e,n){return function(t){return e.parse(t.responseText,n)}}var c=i("text/html",function(e){return document.createRange().createContextualFragment(e.responseText)}),p=i("application/json",function(e){return JSON.parse(e.responseText)}),d=i("text/plain",function(e){return e.responseText}),f=i("application/xml",function(e){var n=e.responseXML;if(!n)throw new Error("parse error");return n}),m=a("text/csv",r.csv),g=a("text/tab-separated-values",r.tsv),h="0.2.6";e.version=h,e.request=o,e.html=c,e.json=p,e.text=d,e.xml=f,e.csv=m,e.tsv=g});
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("d3-collection"),require("d3-dispatch"),require("d3-dsv")):"function"==typeof define&&define.amd?define("d3-request",["exports","d3-collection","d3-dispatch","d3-dsv"],n):n(e.d3_request={},e.d3_collection,e.d3_dispatch,e.d3_dsv)}(this,function(e,n,t,r){"use strict";function o(e,r){function o(){var e,n=f.status;if(!n&&s(f)||n>=200&&300>n||304===n){if(l)try{e=l.call(i,f)}catch(t){return void p.error.call(i,t)}else e=f;p.load.call(i,e)}else p.error.call(i,f)}var i,a,l,c,p=t.dispatch("beforesend","progress","load","error"),d=n.map(),f=new XMLHttpRequest,m=0;return"undefined"==typeof XDomainRequest||"withCredentials"in f||!/^(http(s)?:)?\/\//.test(e)||(f=new XDomainRequest),"onload"in f?f.onload=f.onerror=f.ontimeout=o:f.onreadystatechange=function(){f.readyState>3&&o()},f.onprogress=function(e){p.progress.call(i,e)},i={header:function(e,n){return e=(e+"").toLowerCase(),arguments.length<2?d.get(e):(null==n?d.remove(e):d.set(e,n+""),i)},mimeType:function(e){return arguments.length?(a=null==e?null:e+"",i):a},responseType:function(e){return arguments.length?(c=e,i):c},timeout:function(e){return arguments.length?(m=+e,i):m},response:function(e){return l=e,i},get:function(e,n){return i.send("GET",e,n)},post:function(e,n){return i.send("POST",e,n)},send:function(n,t,r){return r||"function"!=typeof t||(r=t,t=null),r&&1===r.length&&(r=u(r)),f.open(n,e,!0),null==a||d.has("accept")||d.set("accept",a+",*/*"),f.setRequestHeader&&d.each(function(e,n){f.setRequestHeader(n,e)}),null!=a&&f.overrideMimeType&&f.overrideMimeType(a),null!=c&&(f.responseType=c),m>0&&(f.timeout=m),r&&i.on("error",r).on("load",function(e){r(null,e)}),p.beforesend.call(i,f),f.send(null==t?null:t),i},abort:function(){return f.abort(),i},on:function(){var e=p.on.apply(p,arguments);return e===p?i:e}},r?i.get(r):i}function u(e){return function(n,t){e(null==n?t:null)}}function s(e){var n=e.responseType;return n&&"text"!==n?e.response:e.responseText}function i(e,n){return function(t,r){var u=o(t).mimeType(e).response(n);return r?u.get(r):u}}function a(e,n){return function(t,r,u){arguments.length<3&&(u=r,r=null);var s=o(t).mimeType(e);return s.row=function(e){return arguments.length?s.response(l(n,r=e)):r},s.row(r),u?s.get(u):s}}function l(e,n){return function(t){return e.parse(t.responseText,n)}}var c=i("text/html",function(e){return document.createRange().createContextualFragment(e.responseText)}),p=i("application/json",function(e){return JSON.parse(e.responseText)}),d=i("text/plain",function(e){return e.responseText}),f=i("application/xml",function(e){var n=e.responseXML;if(!n)throw new Error("parse error");return n}),m=a("text/csv",r.csv),g=a("text/tab-separated-values",r.tsv),v="0.3.0";e.version=v,e.request=o,e.requestHtml=c,e.requestJson=p,e.requestText=d,e.requestXml=f,e.requestCsv=m,e.requestTsv=g});
export {default as request} from "./src/request";
export {default as html} from "./src/html";
export {default as json} from "./src/json";
export {default as text} from "./src/text";
export {default as xml} from "./src/xml";
export {default as csv} from "./src/csv";
export {default as tsv} from "./src/tsv";
export {default as requestHtml} from "./src/html";
export {default as requestJson} from "./src/json";
export {default as requestText} from "./src/text";
export {default as requestXml} from "./src/xml";
export {default as requestCsv} from "./src/csv";
export {default as requestTsv} from "./src/tsv";
{
"name": "d3-request",
"version": "0.2.6",
"version": "0.3.0",
"description": "A convenient alternative to XMLHttpRequest.",

@@ -30,3 +30,3 @@ "keywords": [

"d3-collection": "~0.1.0",
"d3-dispatch": "~0.2.4",
"d3-dispatch": "~0.2.5",
"d3-dsv": "~0.1.13"

@@ -33,0 +33,0 @@ },

@@ -6,3 +6,3 @@ # d3-request

```js
d3_request.request("/path/to/file.txt", function(error, request) {
d3.request("/path/to/file.txt", function(error, request) {
if (error) return console.error(error.status);

@@ -16,3 +16,3 @@ console.log(request.responseText); // Hello, world!

```js
d3_request.csv("/path/to/file.csv", function(error, data) {
d3.requestCsv("/path/to/file.csv", function(error, data) {
if (error) return console.error(error.status);

@@ -26,3 +26,3 @@ console.log(data); // [{"Hello": "world"}, …]

```js
d3_request.request("/path/to/resource")
d3.request("/path/to/resource")
.header("Content-Type", "application/x-www-form-urlencoded")

@@ -32,3 +32,3 @@ .post("a=2&b=3", callback);

This module has built-in support for parsing [JSON](#json), [XML](#xml), [CSV](#csv) and [TSV](tsv). You can parse additional formats by using [request](#request) or [text](#text) directly.
This module has built-in support for parsing [JSON](#requestJson), [XML](#requestXml), [CSV](#requestCsv) and [TSV](#requestTsv). You can parse additional formats by using [request](#request) or [requestText](#requestText) directly.

@@ -43,3 +43,3 @@ ## Installing

<script src="https://d3js.org/d3-dsv.v0.1.min.js"></script>
<script src="https://d3js.org/d3-request.v0.2.min.js"></script>
<script src="https://d3js.org/d3-request.v0.3.min.js"></script>
```

@@ -51,3 +51,3 @@

<a name="request" href="#request">#</a> d3_request.<b>request</b>(<i>url</i>[, <i>callback</i>])
<a name="request" href="#request">#</a> d3.<b>request</b>(<i>url</i>[, <i>callback</i>])

@@ -57,3 +57,3 @@ Returns a new asynchronous request for specified *url*. If no *callback* is specified, the request is not yet [sent](#request_send) and can be further configured. If a *callback* is specified, it is equivalent to calling [*request*.get](#request_get) immediately after construction:

```js
d3_request.request(url)
d3.request(url)
.get(callback);

@@ -71,3 +71,3 @@ ```

```js
d3_request.request(url)
d3.request(url)
.header("Accept-Language", "en-US")

@@ -84,3 +84,3 @@ .get(callback);

```js
d3_request.request(url)
d3.request(url)
.mimeType("text/csv")

@@ -100,3 +100,3 @@ .get(callback);

Sets the response value function to the specified function and returns this request instance. The response value function is used to map the response XMLHttpRequest object to a useful data value. See the convenience methods [json](#json) and [text](#text) for examples.
Sets the response value function to the specified function and returns this request instance. The response value function is used to map the response XMLHttpRequest object to a useful data value. See the convenience methods [requestJson](#requestJson) and [requestText](#requestText) for examples.

@@ -149,3 +149,3 @@ <a name="request_get" href="#request_get">#</a> <i>request</i>.<b>get</b>([<i>callback</i>])

<a name="csv" href="#csv">#</a> d3_request.<b>csv</b>(<i>url</i>[, <i>row</i>][, <i>callback</i>])
<a name="requestCsv" href="#requestCsv">#</a> d3.<b>requestCsv</b>(<i>url</i>[, <i>row</i>][, <i>callback</i>])

@@ -168,3 +168,3 @@ Creates a request for the [CSV](https://github.com/d3/d3-dsv#csv) file at the specified *url* with the default mime type `"text/csv"`. 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:

```js
d3_request.csv(url, row, callback);
d3.requestCsv(url, row, callback);
```

@@ -175,3 +175,3 @@

```js
d3_request.csv(url)
d3.requestCsv(url)
.row(row)

@@ -184,9 +184,9 @@ .get(callback);

```js
d3_request.request(url)
d3.request(url)
.mimeType("text/csv")
.response(function(xhr) { return d3_dsv.csv.parse(xhr.responseText, row); })
.response(function(xhr) { return d3.csv.parse(xhr.responseText, row); })
.get(callback);
```
<a name="html" href="#html">#</a> d3_request.<b>html</b>(<i>url</i>[, <i>callback</i>])
<a name="requestHtml" href="#requestHtml">#</a> d3.<b>requestHtml</b>(<i>url</i>[, <i>callback</i>])

@@ -198,3 +198,3 @@ Creates a request for the HTML file at the specified *url* with the default mime type "text/html". The HTML file is returned as a [document fragment](https://developer.mozilla.org/en-US/docs/DOM/range.createContextualFragment).

```js
d3_request.request(url)
d3.request(url)
.mimeType("text/html")

@@ -205,3 +205,3 @@ .response(function(xhr) { return document.createRange().createContextualFragment(xhr.responseText); })

<a name="json" href="#json">#</a> d3_request.<b>json</b>(<i>url</i>[, <i>callback</i>])
<a name="requestJson" href="#requestJson">#</a> d3.<b>requestJson</b>(<i>url</i>[, <i>callback</i>])

@@ -213,3 +213,3 @@ Creates a request for the [JSON](http://json.org) file at the specified *url* with the default mime type `"application/json"`.

```js
d3_request.request(url)
d3.request(url)
.mimeType("application/json")

@@ -220,3 +220,3 @@ .response(function(xhr) { return JSON.parse(xhr.responseText); })

<a name="text" href="#text">#</a> d3_request.<b>text</b>(<i>url</i>[, <i>callback</i>])
<a name="requestText" href="#requestText">#</a> d3.<b>requestText</b>(<i>url</i>[, <i>callback</i>])

@@ -228,3 +228,3 @@ Creates a request for the text file at the specified *url* with the default mime type `"text/plain"`.

```js
d3_request.request(url)
d3.request(url)
.mimeType("text/plain")

@@ -235,3 +235,3 @@ .response(function(xhr) { return xhr.responseText; })

<a name="tsv" href="#tsv">#</a> d3_request.<b>tsv</b>(<i>url</i>[, <i>row</i>][, <i>callback</i>])
<a name="requestTsv" href="#requestTsv">#</a> d3.<b>requestTsv</b>(<i>url</i>[, <i>row</i>][, <i>callback</i>])

@@ -254,3 +254,3 @@ Creates a request for the [TSV](https://github.com/d3/d3-dsv#tsv) file at the specified *url* with the default mime type `"text/tab-separated-values"`. 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:

```js
d3_request.tsv(url, row, callback);
d3.requestTsv(url, row, callback);
```

@@ -261,3 +261,3 @@

```js
d3_request.tsv(url)
d3.requestTsv(url)
.row(row)

@@ -270,9 +270,9 @@ .get(callback);

```js
d3_request.request(url)
d3.request(url)
.mimeType("text/tab-separated-values")
.response(function(xhr) { return d3_dsv.tsv.parse(xhr.responseText, row); })
.response(function(xhr) { return d3.tsv.parse(xhr.responseText, row); })
.get(callback);
```
<a name="xml" href="#xml">#</a> d3_request.<b>xml</b>(<i>url</i>[, <i>callback</i>])
<a name="requestXml" href="#requestXml">#</a> d3.<b>requestXml</b>(<i>url</i>[, <i>callback</i>])

@@ -284,3 +284,3 @@ Creates a request for the XML file at the specified *url* with the default mime type `"application/xml"`.

```js
d3_request.request(url)
d3.request(url)
.mimeType("application/xml")

@@ -287,0 +287,0 @@ .response(function(xhr) { return xhr.responseXML; })

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