@common.js/node-fetch 3.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/@types/index.d.ts +219 -0
- package/LICENSE.md +22 -0
- package/README.md +5 -0
- package/package.json +117 -0
- package/src/body.js +902 -0
- package/src/errors/abort-error.js +93 -0
- package/src/errors/base.js +181 -0
- package/src/errors/fetch-error.js +100 -0
- package/src/headers.js +737 -0
- package/src/index.js +602 -0
- package/src/request.js +434 -0
- package/src/response.js +382 -0
- package/src/utils/get-search.js +18 -0
- package/src/utils/is-redirect.js +20 -0
- package/src/utils/is.js +51 -0
- package/src/utils/multipart-parser.js +661 -0
- package/src/utils/referrer.js +272 -0
package/src/response.js
ADDED
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Response.js
|
|
3
|
+
*
|
|
4
|
+
* Response class provides content decoding
|
|
5
|
+
*/ "use strict";
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
Object.defineProperty(exports, "default", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function() {
|
|
12
|
+
return Response;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
var _headersJs = /*#__PURE__*/ _interopRequireDefault(require("./headers.js"));
|
|
16
|
+
var _bodyJs = /*#__PURE__*/ _interopRequireWildcard(require("./body.js"));
|
|
17
|
+
var _isRedirectJs = require("./utils/is-redirect.js");
|
|
18
|
+
function _assertThisInitialized(self) {
|
|
19
|
+
if (self === void 0) {
|
|
20
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
21
|
+
}
|
|
22
|
+
return self;
|
|
23
|
+
}
|
|
24
|
+
function _classCallCheck(instance, Constructor) {
|
|
25
|
+
if (!(instance instanceof Constructor)) {
|
|
26
|
+
throw new TypeError("Cannot call a class as a function");
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function _defineProperties(target, props) {
|
|
30
|
+
for(var i = 0; i < props.length; i++){
|
|
31
|
+
var descriptor = props[i];
|
|
32
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
33
|
+
descriptor.configurable = true;
|
|
34
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
35
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
|
39
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
40
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
41
|
+
return Constructor;
|
|
42
|
+
}
|
|
43
|
+
function _defineProperty(obj, key, value) {
|
|
44
|
+
if (key in obj) {
|
|
45
|
+
Object.defineProperty(obj, key, {
|
|
46
|
+
value: value,
|
|
47
|
+
enumerable: true,
|
|
48
|
+
configurable: true,
|
|
49
|
+
writable: true
|
|
50
|
+
});
|
|
51
|
+
} else {
|
|
52
|
+
obj[key] = value;
|
|
53
|
+
}
|
|
54
|
+
return obj;
|
|
55
|
+
}
|
|
56
|
+
function _getPrototypeOf(o) {
|
|
57
|
+
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
58
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
59
|
+
};
|
|
60
|
+
return _getPrototypeOf(o);
|
|
61
|
+
}
|
|
62
|
+
function _inherits(subClass, superClass) {
|
|
63
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
64
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
65
|
+
}
|
|
66
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
67
|
+
constructor: {
|
|
68
|
+
value: subClass,
|
|
69
|
+
writable: true,
|
|
70
|
+
configurable: true
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
74
|
+
}
|
|
75
|
+
function _interopRequireDefault(obj) {
|
|
76
|
+
return obj && obj.__esModule ? obj : {
|
|
77
|
+
default: obj
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
81
|
+
if (typeof WeakMap !== "function") return null;
|
|
82
|
+
var cacheBabelInterop = new WeakMap();
|
|
83
|
+
var cacheNodeInterop = new WeakMap();
|
|
84
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
85
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
86
|
+
})(nodeInterop);
|
|
87
|
+
}
|
|
88
|
+
function _interopRequireWildcard(obj, nodeInterop) {
|
|
89
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
90
|
+
return obj;
|
|
91
|
+
}
|
|
92
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
93
|
+
return {
|
|
94
|
+
default: obj
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
98
|
+
if (cache && cache.has(obj)) {
|
|
99
|
+
return cache.get(obj);
|
|
100
|
+
}
|
|
101
|
+
var newObj = {};
|
|
102
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
103
|
+
for(var key in obj){
|
|
104
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
105
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
106
|
+
if (desc && (desc.get || desc.set)) {
|
|
107
|
+
Object.defineProperty(newObj, key, desc);
|
|
108
|
+
} else {
|
|
109
|
+
newObj[key] = obj[key];
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
newObj.default = obj;
|
|
114
|
+
if (cache) {
|
|
115
|
+
cache.set(obj, newObj);
|
|
116
|
+
}
|
|
117
|
+
return newObj;
|
|
118
|
+
}
|
|
119
|
+
function _objectSpread(target) {
|
|
120
|
+
for(var i = 1; i < arguments.length; i++){
|
|
121
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
122
|
+
var ownKeys = Object.keys(source);
|
|
123
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
124
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
125
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
126
|
+
}));
|
|
127
|
+
}
|
|
128
|
+
ownKeys.forEach(function(key) {
|
|
129
|
+
_defineProperty(target, key, source[key]);
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
return target;
|
|
133
|
+
}
|
|
134
|
+
function ownKeys(object, enumerableOnly) {
|
|
135
|
+
var keys = Object.keys(object);
|
|
136
|
+
if (Object.getOwnPropertySymbols) {
|
|
137
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
138
|
+
if (enumerableOnly) {
|
|
139
|
+
symbols = symbols.filter(function(sym) {
|
|
140
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
keys.push.apply(keys, symbols);
|
|
144
|
+
}
|
|
145
|
+
return keys;
|
|
146
|
+
}
|
|
147
|
+
function _objectSpreadProps(target, source) {
|
|
148
|
+
source = source != null ? source : {};
|
|
149
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
150
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
151
|
+
} else {
|
|
152
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
153
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
return target;
|
|
157
|
+
}
|
|
158
|
+
function _possibleConstructorReturn(self, call) {
|
|
159
|
+
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
|
160
|
+
return call;
|
|
161
|
+
}
|
|
162
|
+
return _assertThisInitialized(self);
|
|
163
|
+
}
|
|
164
|
+
function _setPrototypeOf(o, p) {
|
|
165
|
+
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
166
|
+
o.__proto__ = p;
|
|
167
|
+
return o;
|
|
168
|
+
};
|
|
169
|
+
return _setPrototypeOf(o, p);
|
|
170
|
+
}
|
|
171
|
+
var _typeof = function(obj) {
|
|
172
|
+
"@swc/helpers - typeof";
|
|
173
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
174
|
+
};
|
|
175
|
+
function _isNativeReflectConstruct() {
|
|
176
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
177
|
+
if (Reflect.construct.sham) return false;
|
|
178
|
+
if (typeof Proxy === "function") return true;
|
|
179
|
+
try {
|
|
180
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
181
|
+
return true;
|
|
182
|
+
} catch (e) {
|
|
183
|
+
return false;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
function _createSuper(Derived) {
|
|
187
|
+
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
188
|
+
return function _createSuperInternal() {
|
|
189
|
+
var Super = _getPrototypeOf(Derived), result;
|
|
190
|
+
if (hasNativeReflectConstruct) {
|
|
191
|
+
var NewTarget = _getPrototypeOf(this).constructor;
|
|
192
|
+
result = Reflect.construct(Super, arguments, NewTarget);
|
|
193
|
+
} else {
|
|
194
|
+
result = Super.apply(this, arguments);
|
|
195
|
+
}
|
|
196
|
+
return _possibleConstructorReturn(this, result);
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
var INTERNALS = Symbol("Response internals");
|
|
200
|
+
var Response = /*#__PURE__*/ function(Body) {
|
|
201
|
+
"use strict";
|
|
202
|
+
_inherits(Response, Body);
|
|
203
|
+
var _super = _createSuper(Response);
|
|
204
|
+
function Response() {
|
|
205
|
+
var body = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null, options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
206
|
+
_classCallCheck(this, Response);
|
|
207
|
+
var _this;
|
|
208
|
+
_this = _super.call(this, body, options);
|
|
209
|
+
// eslint-disable-next-line no-eq-null, eqeqeq, no-negated-condition
|
|
210
|
+
var status = options.status != null ? options.status : 200;
|
|
211
|
+
var headers = new _headersJs.default(options.headers);
|
|
212
|
+
if (body !== null && !headers.has("Content-Type")) {
|
|
213
|
+
var contentType = (0, _bodyJs.extractContentType)(body, _assertThisInitialized(_this));
|
|
214
|
+
if (contentType) {
|
|
215
|
+
headers.append("Content-Type", contentType);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
_this[INTERNALS] = {
|
|
219
|
+
type: "default",
|
|
220
|
+
url: options.url,
|
|
221
|
+
status: status,
|
|
222
|
+
statusText: options.statusText || "",
|
|
223
|
+
headers: headers,
|
|
224
|
+
counter: options.counter,
|
|
225
|
+
highWaterMark: options.highWaterMark
|
|
226
|
+
};
|
|
227
|
+
return _this;
|
|
228
|
+
}
|
|
229
|
+
_createClass(Response, [
|
|
230
|
+
{
|
|
231
|
+
key: "type",
|
|
232
|
+
get: function get() {
|
|
233
|
+
return this[INTERNALS].type;
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
key: "url",
|
|
238
|
+
get: function get() {
|
|
239
|
+
return this[INTERNALS].url || "";
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
key: "status",
|
|
244
|
+
get: function get() {
|
|
245
|
+
return this[INTERNALS].status;
|
|
246
|
+
}
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
key: "ok",
|
|
250
|
+
get: /**
|
|
251
|
+
* Convenience property representing if the request ended normally
|
|
252
|
+
*/ function get() {
|
|
253
|
+
return this[INTERNALS].status >= 200 && this[INTERNALS].status < 300;
|
|
254
|
+
}
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
key: "redirected",
|
|
258
|
+
get: function get() {
|
|
259
|
+
return this[INTERNALS].counter > 0;
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
key: "statusText",
|
|
264
|
+
get: function get() {
|
|
265
|
+
return this[INTERNALS].statusText;
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
key: "headers",
|
|
270
|
+
get: function get() {
|
|
271
|
+
return this[INTERNALS].headers;
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
key: "highWaterMark",
|
|
276
|
+
get: function get() {
|
|
277
|
+
return this[INTERNALS].highWaterMark;
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
/**
|
|
282
|
+
* Clone this response
|
|
283
|
+
*
|
|
284
|
+
* @return Response
|
|
285
|
+
*/ key: "clone",
|
|
286
|
+
value: function clone() {
|
|
287
|
+
return new Response((0, _bodyJs.clone)(this, this.highWaterMark), {
|
|
288
|
+
type: this.type,
|
|
289
|
+
url: this.url,
|
|
290
|
+
status: this.status,
|
|
291
|
+
statusText: this.statusText,
|
|
292
|
+
headers: this.headers,
|
|
293
|
+
ok: this.ok,
|
|
294
|
+
redirected: this.redirected,
|
|
295
|
+
size: this.size,
|
|
296
|
+
highWaterMark: this.highWaterMark
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
key: Symbol.toStringTag,
|
|
302
|
+
get: function get() {
|
|
303
|
+
return "Response";
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
], [
|
|
307
|
+
{
|
|
308
|
+
key: "redirect",
|
|
309
|
+
value: /**
|
|
310
|
+
* @param {string} url The URL that the new response is to originate from.
|
|
311
|
+
* @param {number} status An optional status code for the response (e.g., 302.)
|
|
312
|
+
* @returns {Response} A Response object.
|
|
313
|
+
*/ function redirect(url) {
|
|
314
|
+
var status = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 302;
|
|
315
|
+
if (!(0, _isRedirectJs.isRedirect)(status)) {
|
|
316
|
+
throw new RangeError('Failed to execute "redirect" on "response": Invalid status code');
|
|
317
|
+
}
|
|
318
|
+
return new Response(null, {
|
|
319
|
+
headers: {
|
|
320
|
+
location: new URL(url).toString()
|
|
321
|
+
},
|
|
322
|
+
status: status
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
key: "error",
|
|
328
|
+
value: function error() {
|
|
329
|
+
var response = new Response(null, {
|
|
330
|
+
status: 0,
|
|
331
|
+
statusText: ""
|
|
332
|
+
});
|
|
333
|
+
response[INTERNALS].type = "error";
|
|
334
|
+
return response;
|
|
335
|
+
}
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
key: "json",
|
|
339
|
+
value: function json() {
|
|
340
|
+
var data = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : undefined, init = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
341
|
+
var body = JSON.stringify(data);
|
|
342
|
+
if (body === undefined) {
|
|
343
|
+
throw new TypeError("data is not JSON serializable");
|
|
344
|
+
}
|
|
345
|
+
var headers = new _headersJs.default(init && init.headers);
|
|
346
|
+
if (!headers.has("content-type")) {
|
|
347
|
+
headers.set("content-type", "application/json");
|
|
348
|
+
}
|
|
349
|
+
return new Response(body, _objectSpreadProps(_objectSpread({}, init), {
|
|
350
|
+
headers: headers
|
|
351
|
+
}));
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
]);
|
|
355
|
+
return Response;
|
|
356
|
+
}(_bodyJs.default);
|
|
357
|
+
Object.defineProperties(Response.prototype, {
|
|
358
|
+
type: {
|
|
359
|
+
enumerable: true
|
|
360
|
+
},
|
|
361
|
+
url: {
|
|
362
|
+
enumerable: true
|
|
363
|
+
},
|
|
364
|
+
status: {
|
|
365
|
+
enumerable: true
|
|
366
|
+
},
|
|
367
|
+
ok: {
|
|
368
|
+
enumerable: true
|
|
369
|
+
},
|
|
370
|
+
redirected: {
|
|
371
|
+
enumerable: true
|
|
372
|
+
},
|
|
373
|
+
statusText: {
|
|
374
|
+
enumerable: true
|
|
375
|
+
},
|
|
376
|
+
headers: {
|
|
377
|
+
enumerable: true
|
|
378
|
+
},
|
|
379
|
+
clone: {
|
|
380
|
+
enumerable: true
|
|
381
|
+
}
|
|
382
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "getSearch", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return getSearch;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
var getSearch = function(parsedURL) {
|
|
12
|
+
if (parsedURL.search) {
|
|
13
|
+
return parsedURL.search;
|
|
14
|
+
}
|
|
15
|
+
var lastOffset = parsedURL.href.length - 1;
|
|
16
|
+
var hash = parsedURL.hash || (parsedURL.href[lastOffset] === "#" ? "#" : "");
|
|
17
|
+
return parsedURL.href[lastOffset - hash.length] === "?" ? "?" : "";
|
|
18
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "isRedirect", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return isRedirect;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
var redirectStatus = new Set([
|
|
12
|
+
301,
|
|
13
|
+
302,
|
|
14
|
+
303,
|
|
15
|
+
307,
|
|
16
|
+
308
|
|
17
|
+
]);
|
|
18
|
+
var isRedirect = function(code) {
|
|
19
|
+
return redirectStatus.has(code);
|
|
20
|
+
};
|
package/src/utils/is.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Is.js
|
|
3
|
+
*
|
|
4
|
+
* Object type checks.
|
|
5
|
+
*/ "use strict";
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
function _export(target, all) {
|
|
10
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: all[name]
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
_export(exports, {
|
|
16
|
+
isURLSearchParameters: function() {
|
|
17
|
+
return isURLSearchParameters;
|
|
18
|
+
},
|
|
19
|
+
isBlob: function() {
|
|
20
|
+
return isBlob;
|
|
21
|
+
},
|
|
22
|
+
isAbortSignal: function() {
|
|
23
|
+
return isAbortSignal;
|
|
24
|
+
},
|
|
25
|
+
isDomainOrSubdomain: function() {
|
|
26
|
+
return isDomainOrSubdomain;
|
|
27
|
+
},
|
|
28
|
+
isSameProtocol: function() {
|
|
29
|
+
return isSameProtocol;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
var NAME = Symbol.toStringTag;
|
|
33
|
+
var isURLSearchParameters = function(object) {
|
|
34
|
+
return typeof object === "object" && typeof object.append === "function" && typeof object.delete === "function" && typeof object.get === "function" && typeof object.getAll === "function" && typeof object.has === "function" && typeof object.set === "function" && typeof object.sort === "function" && object[NAME] === "URLSearchParams";
|
|
35
|
+
};
|
|
36
|
+
var isBlob = function(object) {
|
|
37
|
+
return object && typeof object === "object" && typeof object.arrayBuffer === "function" && typeof object.type === "string" && typeof object.stream === "function" && typeof object.constructor === "function" && /^(Blob|File)$/.test(object[NAME]);
|
|
38
|
+
};
|
|
39
|
+
var isAbortSignal = function(object) {
|
|
40
|
+
return typeof object === "object" && (object[NAME] === "AbortSignal" || object[NAME] === "EventTarget");
|
|
41
|
+
};
|
|
42
|
+
var isDomainOrSubdomain = function(destination, original) {
|
|
43
|
+
var orig = new URL(original).hostname;
|
|
44
|
+
var dest = new URL(destination).hostname;
|
|
45
|
+
return orig === dest || orig.endsWith(".".concat(dest));
|
|
46
|
+
};
|
|
47
|
+
var isSameProtocol = function(destination, original) {
|
|
48
|
+
var orig = new URL(original).protocol;
|
|
49
|
+
var dest = new URL(destination).protocol;
|
|
50
|
+
return orig === dest;
|
|
51
|
+
};
|