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 1.0.0 to 1.0.1

23

build/d3-request.js

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

// https://d3js.org/d3-request/ Version 1.0.0. Copyright 2016 Mike Bostock.
// https://d3js.org/d3-request/ Version 1.0.1. Copyright 2016 Mike Bostock.
(function (global, factory) {

@@ -111,4 +111,2 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-collection'), require('d3-dispatch'), require('d3-dsv')) :

send: function(method, data, callback) {
if (!callback && typeof data === "function") callback = data, data = null;
if (callback && callback.length === 1) callback = fixCallback(callback);
xhr.open(method, url, true, user, password);

@@ -120,3 +118,5 @@ if (mimeType != null && !headers.has("accept")) headers.set("accept", mimeType + ",*/*");

if (timeout > 0) xhr.timeout = timeout;
if (callback) request.on("error", callback).on("load", function(xhr) { callback(null, xhr); });
if (callback == null && typeof data === "function") callback = data, data = null;
if (callback != null && callback.length === 1) callback = fixCallback(callback);
if (callback != null) request.on("error", callback).on("load", function(xhr) { callback(null, xhr); });
event.call("beforesend", request, xhr);

@@ -138,5 +138,8 @@ xhr.send(data == null ? null : data);

return callback
? request.get(callback)
: request;
if (callback != null) {
if (typeof callback !== "function") throw new Error("invalid callback: " + callback);
return request.get(callback);
}
return request;
}

@@ -160,3 +163,7 @@

var r = request(url).mimeType(defaultMimeType).response(response);
return callback ? r.get(callback) : r;
if (callback != null) {
if (typeof callback !== "function") throw new Error("invalid callback: " + callback);
return r.get(callback);
}
return r;
};

@@ -163,0 +170,0 @@ }

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

// https://d3js.org/d3-request/ Version 1.0.0. Copyright 2016 Mike Bostock.
!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(["exports","d3-collection","d3-dispatch","d3-dsv"],n):n(e.d3=e.d3||{},e.d3,e.d3,e.d3)}(this,function(e,n,t,r){"use strict";function o(e,r){function o(e){var n,t=d.status;if(!t&&s(d)||t>=200&&300>t||304===t){if(c)try{n=c.call(l,d)}catch(r){return void p.call("error",l,r)}else n=d;p.call("load",l,n)}else p.call("error",l,e)}var l,i,c,a,p=t.dispatch("beforesend","progress","load","error"),f=n.map(),d=new XMLHttpRequest,h=null,m=null,v=0;return"undefined"==typeof XDomainRequest||"withCredentials"in d||!/^(http(s)?:)?\/\//.test(e)||(d=new XDomainRequest),"onload"in d?d.onload=d.onerror=d.ontimeout=o:d.onreadystatechange=function(e){d.readyState>3&&o(e)},d.onprogress=function(e){p.call("progress",l,e)},l={header:function(e,n){return e=(e+"").toLowerCase(),arguments.length<2?f.get(e):(null==n?f.remove(e):f.set(e,n+""),l)},mimeType:function(e){return arguments.length?(i=null==e?null:e+"",l):i},responseType:function(e){return arguments.length?(a=e,l):a},timeout:function(e){return arguments.length?(v=+e,l):v},user:function(e){return arguments.length<1?h:(h=null==e?null:e+"",l)},password:function(e){return arguments.length<1?m:(m=null==e?null:e+"",l)},response:function(e){return c=e,l},get:function(e,n){return l.send("GET",e,n)},post:function(e,n){return l.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)),d.open(n,e,!0,h,m),null==i||f.has("accept")||f.set("accept",i+",*/*"),d.setRequestHeader&&f.each(function(e,n){d.setRequestHeader(n,e)}),null!=i&&d.overrideMimeType&&d.overrideMimeType(i),null!=a&&(d.responseType=a),v>0&&(d.timeout=v),r&&l.on("error",r).on("load",function(e){r(null,e)}),p.call("beforesend",l,d),d.send(null==t?null:t),l},abort:function(){return d.abort(),l},on:function(){var e=p.on.apply(p,arguments);return e===p?l:e}},r?l.get(r):l}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 l(e,n){return function(t,r){var u=o(t).mimeType(e).response(n);return r?u.get(r):u}}function i(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(c(n,r=e)):r},s.row(r),u?s.get(u):s}}function c(e,n){return function(t){return e(t.responseText,n)}}var a=l("text/html",function(e){return document.createRange().createContextualFragment(e.responseText)}),p=l("application/json",function(e){return JSON.parse(e.responseText)}),f=l("text/plain",function(e){return e.responseText}),d=l("application/xml",function(e){var n=e.responseXML;if(!n)throw new Error("parse error");return n}),h=i("text/csv",r.csvParse),m=i("text/tab-separated-values",r.tsvParse);e.request=o,e.html=a,e.json=p,e.text=f,e.xml=d,e.csv=h,e.tsv=m,Object.defineProperty(e,"__esModule",{value:!0})});
// https://d3js.org/d3-request/ Version 1.0.1. Copyright 2016 Mike Bostock.
!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(["exports","d3-collection","d3-dispatch","d3-dsv"],n):n(e.d3=e.d3||{},e.d3,e.d3,e.d3)}(this,function(e,n,t,r){"use strict";function o(e,r){function o(e){var n,t=d.status;if(!t&&l(d)||t>=200&&t<300||304===t){if(c)try{n=c.call(i,d)}catch(e){return void f.call("error",i,e)}else n=d;f.call("load",i,n)}else f.call("error",i,e)}var i,s,c,a,f=t.dispatch("beforesend","progress","load","error"),p=n.map(),d=new XMLHttpRequest,h=null,m=null,v=0;if("undefined"==typeof XDomainRequest||"withCredentials"in d||!/^(http(s)?:)?\/\//.test(e)||(d=new XDomainRequest),"onload"in d?d.onload=d.onerror=d.ontimeout=o:d.onreadystatechange=function(e){d.readyState>3&&o(e)},d.onprogress=function(e){f.call("progress",i,e)},i={header:function(e,n){return e=(e+"").toLowerCase(),arguments.length<2?p.get(e):(null==n?p.remove(e):p.set(e,n+""),i)},mimeType:function(e){return arguments.length?(s=null==e?null:e+"",i):s},responseType:function(e){return arguments.length?(a=e,i):a},timeout:function(e){return arguments.length?(v=+e,i):v},user:function(e){return arguments.length<1?h:(h=null==e?null:e+"",i)},password:function(e){return arguments.length<1?m:(m=null==e?null:e+"",i)},response:function(e){return c=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 d.open(n,e,!0,h,m),null==s||p.has("accept")||p.set("accept",s+",*/*"),d.setRequestHeader&&p.each(function(e,n){d.setRequestHeader(n,e)}),null!=s&&d.overrideMimeType&&d.overrideMimeType(s),null!=a&&(d.responseType=a),v>0&&(d.timeout=v),null==r&&"function"==typeof t&&(r=t,t=null),null!=r&&1===r.length&&(r=u(r)),null!=r&&i.on("error",r).on("load",function(e){r(null,e)}),f.call("beforesend",i,d),d.send(null==t?null:t),i},abort:function(){return d.abort(),i},on:function(){var e=f.on.apply(f,arguments);return e===f?i:e}},null!=r){if("function"!=typeof r)throw new Error("invalid callback: "+r);return i.get(r)}return i}function u(e){return function(n,t){e(null==n?t:null)}}function l(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);if(null!=r){if("function"!=typeof r)throw new Error("invalid callback: "+r);return u.get(r)}return u}}function s(e,n){return function(t,r,u){arguments.length<3&&(u=r,r=null);var l=o(t).mimeType(e);return l.row=function(e){return arguments.length?l.response(c(n,r=e)):r},l.row(r),u?l.get(u):l}}function c(e,n){return function(t){return e(t.responseText,n)}}var a=i("text/html",function(e){return document.createRange().createContextualFragment(e.responseText)}),f=i("application/json",function(e){return JSON.parse(e.responseText)}),p=i("text/plain",function(e){return e.responseText}),d=i("application/xml",function(e){var n=e.responseXML;if(!n)throw new Error("parse error");return n}),h=s("text/csv",r.csvParse),m=s("text/tab-separated-values",r.tsvParse);e.request=o,e.html=a,e.json=f,e.text=p,e.xml=d,e.csv=h,e.tsv=m,Object.defineProperty(e,"__esModule",{value:!0})});

@@ -114,4 +114,2 @@ 'use strict';

send: function(method, data, callback) {
if (!callback && typeof data === "function") callback = data, data = null;
if (callback && callback.length === 1) callback = fixCallback(callback);
xhr.open(method, url, true, user, password);

@@ -123,3 +121,5 @@ if (mimeType != null && !headers.has("accept")) headers.set("accept", mimeType + ",*/*");

if (timeout > 0) xhr.timeout = timeout;
if (callback) request.on("error", callback).on("load", function(xhr) { callback(null, xhr); });
if (callback == null && typeof data === "function") callback = data, data = null;
if (callback != null && callback.length === 1) callback = fixCallback(callback);
if (callback != null) request.on("error", callback).on("load", function(xhr) { callback(null, xhr); });
event.call("beforesend", request, xhr);

@@ -141,5 +141,8 @@ xhr.send(data == null ? null : data);

return callback
? request.get(callback)
: request;
if (callback != null) {
if (typeof callback !== "function") throw new Error("invalid callback: " + callback);
return request.get(callback);
}
return request;
}

@@ -163,3 +166,7 @@

var r = request(url).mimeType(defaultMimeType).response(response);
return callback ? r.get(callback) : r;
if (callback != null) {
if (typeof callback !== "function") throw new Error("invalid callback: " + callback);
return r.get(callback);
}
return r;
};

@@ -166,0 +173,0 @@ }

{
"name": "d3-request",
"version": "1.0.0",
"version": "1.0.1",
"description": "A convenient alternative to XMLHttpRequest.",

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

"prepublish": "npm run test && uglifyjs --preamble \"$(preamble)\" build/d3-request.js -c -m -o build/d3-request.min.js",
"postpublish": "VERSION=`node -e 'console.log(require(\"./package.json\").version)'`; git push && git push --tags && cp build/d3-request.js ../d3.github.com/d3-request.v1.js && cp build/d3-request.min.js ../d3.github.com/d3-request.v1.min.js && cd ../d3.github.com && git add d3-request.v1.js d3-request.v1.min.js && git commit -m \"d3-request ${VERSION}\" && git push && cd - && zip -j build/d3-request.zip -- LICENSE README.md build/d3-request.js build/d3-request.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-request/build/d3-request.js d3-request.v1.js && cp ../d3-request/build/d3-request.min.js d3-request.v1.min.js && git add d3-request.v1.js d3-request.v1.min.js && git commit -m \"d3-request ${VERSION}\" && git push && cd - && zip -j build/d3-request.zip -- LICENSE README.md build/d3-request.js build/d3-request.min.js"
},

@@ -41,3 +41,3 @@ "dependencies": {

"package-preamble": "0.0",
"rollup": "0.31",
"rollup": "0.33",
"tape": "4",

@@ -44,0 +44,0 @@ "uglify-js": "2"

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

<a name="request_get" href="#request_get">#</a> <i>request</i>.<b>get</b>([<i>callback</i>])
<a name="request_get" href="#request_get">#</a> <i>request</i>.<b>get</b>([<i>data</i>][, <i>callback</i>])

@@ -116,3 +116,3 @@ Equivalent to [*request*.send](#request_send) with the GET method:

```js
request.send("GET", callback);
request.send("GET", data, callback);
```

@@ -136,3 +136,3 @@

.on("load", function(xhr) { callback(null, xhr); })
.send(method);
.send(method, data);
```

@@ -139,0 +139,0 @@

@@ -107,4 +107,2 @@ import {map} from "d3-collection";

send: function(method, data, callback) {
if (!callback && typeof data === "function") callback = data, data = null;
if (callback && callback.length === 1) callback = fixCallback(callback);
xhr.open(method, url, true, user, password);

@@ -116,3 +114,5 @@ if (mimeType != null && !headers.has("accept")) headers.set("accept", mimeType + ",*/*");

if (timeout > 0) xhr.timeout = timeout;
if (callback) request.on("error", callback).on("load", function(xhr) { callback(null, xhr); });
if (callback == null && typeof data === "function") callback = data, data = null;
if (callback != null && callback.length === 1) callback = fixCallback(callback);
if (callback != null) request.on("error", callback).on("load", function(xhr) { callback(null, xhr); });
event.call("beforesend", request, xhr);

@@ -134,5 +134,8 @@ xhr.send(data == null ? null : data);

return callback
? request.get(callback)
: request;
if (callback != null) {
if (typeof callback !== "function") throw new Error("invalid callback: " + callback);
return request.get(callback);
}
return request;
}

@@ -139,0 +142,0 @@

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

var r = request(url).mimeType(defaultMimeType).response(response);
return callback ? r.get(callback) : r;
if (callback != null) {
if (typeof callback !== "function") throw new Error("invalid callback: " + callback);
return r.get(callback);
}
return r;
};
}
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