Node-Red configuration
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

d3-fetch.js 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. // https://d3js.org/d3-fetch/ v3.0.1 Copyright 2016-2021 Mike Bostock
  2. (function (global, factory) {
  3. typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-dsv')) :
  4. typeof define === 'function' && define.amd ? define(['exports', 'd3-dsv'], factory) :
  5. (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.d3 = global.d3 || {}, global.d3));
  6. }(this, (function (exports, d3Dsv) { 'use strict';
  7. function responseBlob(response) {
  8. if (!response.ok) throw new Error(response.status + " " + response.statusText);
  9. return response.blob();
  10. }
  11. function blob(input, init) {
  12. return fetch(input, init).then(responseBlob);
  13. }
  14. function responseArrayBuffer(response) {
  15. if (!response.ok) throw new Error(response.status + " " + response.statusText);
  16. return response.arrayBuffer();
  17. }
  18. function buffer(input, init) {
  19. return fetch(input, init).then(responseArrayBuffer);
  20. }
  21. function responseText(response) {
  22. if (!response.ok) throw new Error(response.status + " " + response.statusText);
  23. return response.text();
  24. }
  25. function text(input, init) {
  26. return fetch(input, init).then(responseText);
  27. }
  28. function dsvParse(parse) {
  29. return function(input, init, row) {
  30. if (arguments.length === 2 && typeof init === "function") row = init, init = undefined;
  31. return text(input, init).then(function(response) {
  32. return parse(response, row);
  33. });
  34. };
  35. }
  36. function dsv(delimiter, input, init, row) {
  37. if (arguments.length === 3 && typeof init === "function") row = init, init = undefined;
  38. var format = d3Dsv.dsvFormat(delimiter);
  39. return text(input, init).then(function(response) {
  40. return format.parse(response, row);
  41. });
  42. }
  43. var csv = dsvParse(d3Dsv.csvParse);
  44. var tsv = dsvParse(d3Dsv.tsvParse);
  45. function image(input, init) {
  46. return new Promise(function(resolve, reject) {
  47. var image = new Image;
  48. for (var key in init) image[key] = init[key];
  49. image.onerror = reject;
  50. image.onload = function() { resolve(image); };
  51. image.src = input;
  52. });
  53. }
  54. function responseJson(response) {
  55. if (!response.ok) throw new Error(response.status + " " + response.statusText);
  56. if (response.status === 204 || response.status === 205) return;
  57. return response.json();
  58. }
  59. function json(input, init) {
  60. return fetch(input, init).then(responseJson);
  61. }
  62. function parser(type) {
  63. return (input, init) => text(input, init)
  64. .then(text => (new DOMParser).parseFromString(text, type));
  65. }
  66. var xml = parser("application/xml");
  67. var html = parser("text/html");
  68. var svg = parser("image/svg+xml");
  69. exports.blob = blob;
  70. exports.buffer = buffer;
  71. exports.csv = csv;
  72. exports.dsv = dsv;
  73. exports.html = html;
  74. exports.image = image;
  75. exports.json = json;
  76. exports.svg = svg;
  77. exports.text = text;
  78. exports.tsv = tsv;
  79. exports.xml = xml;
  80. Object.defineProperty(exports, '__esModule', { value: true });
  81. })));