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.3.0 to 0.3.1

.eslintrc

2

build/bundle.js

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

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

@@ -24,5 +24,5 @@ (function (global, factory) {

? xhr.onload = xhr.onerror = xhr.ontimeout = respond
: xhr.onreadystatechange = function() { xhr.readyState > 3 && respond(); };
: xhr.onreadystatechange = function(o) { xhr.readyState > 3 && respond(o); };
function respond() {
function respond(o) {
var status = xhr.status, result;

@@ -44,3 +44,3 @@ if (!status && hasResponse(xhr)

} else {
event.error.call(request, xhr);
event.error.call(request, o);
}

@@ -130,3 +130,3 @@ }

: request;
};
}

@@ -151,3 +151,3 @@ function fixCallback(callback) {

};
};
}

@@ -180,3 +180,3 @@ var html = requestType("text/html", function(xhr) {

};
};
}

@@ -193,3 +193,3 @@ function responseOf(dsv, row) {

var version = "0.3.0";
var version = "0.3.1";

@@ -196,0 +196,0 @@ exports.version = version;

@@ -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),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});
!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(e){var n,t=f.status;if(!t&&s(f)||t>=200&&300>t||304===t){if(l)try{n=l.call(i,f)}catch(r){return void p.error.call(i,r)}else n=f;p.load.call(i,n)}else p.error.call(i,e)}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(e){f.readyState>3&&o(e)},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.1";e.version=v,e.request=o,e.requestHtml=c,e.requestJson=p,e.requestText=d,e.requestXml=f,e.requestCsv=m,e.requestTsv=g});
{
"name": "d3-request",
"version": "0.3.0",
"version": "0.3.1",
"description": "A convenient alternative to XMLHttpRequest.",

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

"pretest": "mkdir -p build && node -e 'process.stdout.write(\"var version = \\\"\" + require(\"./package.json\").version + \"\\\"; export * from \\\"../index\\\"; export {version};\");' > build/bundle.js && rollup -f umd -g d3-collection:d3_collection,d3-dispatch:d3_dispatch,d3-dsv:d3_dsv -u d3-request -n d3_request -o build/d3-request.js -- build/bundle.js",
"test": "faucet `find test -name '*-test.js'`",
"test": "faucet `find test -name '*-test.js'` && eslint index.js src",
"prepublish": "npm run test && uglifyjs build/d3-request.js -c -m -o build/d3-request.min.js && rm -f build/d3-request.zip && zip -j build/d3-request.zip -- LICENSE README.md build/d3-request.js build/d3-request.min.js"

@@ -28,0 +28,0 @@ },

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

```js
d3.request("/path/to/file.txt", function(error, request) {
if (error) return console.error(error.status);
console.log(request.responseText); // Hello, world!
d3.requestText("/path/to/file.txt", function(error, text) {
if (error) throw error;
console.log(text); // Hello, world!
});

@@ -17,3 +17,3 @@ ```

d3.requestCsv("/path/to/file.csv", function(error, data) {
if (error) return console.error(error.status);
if (error) throw error;
console.log(data); // [{"Hello": "world"}, …]

@@ -117,3 +117,3 @@ });

request
.on("error", function(xhr) { callback(xhr); })
.on("error", function(error) { callback(error); })
.on("load", function(xhr) { callback(null, xhr); })

@@ -120,0 +120,0 @@ .send(method);

@@ -21,5 +21,5 @@ import {map} from "d3-collection";

? xhr.onload = xhr.onerror = xhr.ontimeout = respond
: xhr.onreadystatechange = function() { xhr.readyState > 3 && respond(); };
: xhr.onreadystatechange = function(o) { xhr.readyState > 3 && respond(o); };
function respond() {
function respond(o) {
var status = xhr.status, result;

@@ -41,3 +41,3 @@ if (!status && hasResponse(xhr)

} else {
event.error.call(request, xhr);
event.error.call(request, o);
}

@@ -127,3 +127,3 @@ }

: request;
};
}

@@ -130,0 +130,0 @@ function fixCallback(callback) {

@@ -11,3 +11,3 @@ import request from "./request";

};
};
}

@@ -14,0 +14,0 @@ function responseOf(dsv, row) {

@@ -8,2 +8,2 @@ import request from "./request";

};
};
}
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