1 | ;
|
2 |
|
3 | function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
4 | function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
5 | function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
6 | /**
|
7 | * Return the mime type for the given `str`.
|
8 | *
|
9 | * @param {String} str
|
10 | * @return {String}
|
11 | * @api private
|
12 | */
|
13 |
|
14 | exports.type = string_ => string_.split(/ *; */).shift();
|
15 |
|
16 | /**
|
17 | * Return header field parameters.
|
18 | *
|
19 | * @param {String} str
|
20 | * @return {Object}
|
21 | * @api private
|
22 | */
|
23 |
|
24 | exports.params = value => {
|
25 | const object = {};
|
26 | var _iterator = _createForOfIteratorHelper(value.split(/ *; */)),
|
27 | _step;
|
28 | try {
|
29 | for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
30 | const string_ = _step.value;
|
31 | const parts = string_.split(/ *= */);
|
32 | const key = parts.shift();
|
33 | const value = parts.shift();
|
34 | if (key && value) object[key] = value;
|
35 | }
|
36 | } catch (err) {
|
37 | _iterator.e(err);
|
38 | } finally {
|
39 | _iterator.f();
|
40 | }
|
41 | return object;
|
42 | };
|
43 |
|
44 | /**
|
45 | * Parse Link header fields.
|
46 | *
|
47 | * @param {String} str
|
48 | * @return {Object}
|
49 | * @api private
|
50 | */
|
51 |
|
52 | exports.parseLinks = value => {
|
53 | const object = {};
|
54 | var _iterator2 = _createForOfIteratorHelper(value.split(/ *, */)),
|
55 | _step2;
|
56 | try {
|
57 | for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
58 | const string_ = _step2.value;
|
59 | const parts = string_.split(/ *; */);
|
60 | const url = parts[0].slice(1, -1);
|
61 | const rel = parts[1].split(/ *= */)[1].slice(1, -1);
|
62 | object[rel] = url;
|
63 | }
|
64 | } catch (err) {
|
65 | _iterator2.e(err);
|
66 | } finally {
|
67 | _iterator2.f();
|
68 | }
|
69 | return object;
|
70 | };
|
71 |
|
72 | /**
|
73 | * Strip content related fields from `header`.
|
74 | *
|
75 | * @param {Object} header
|
76 | * @return {Object} header
|
77 | * @api private
|
78 | */
|
79 |
|
80 | exports.cleanHeader = (header, changesOrigin) => {
|
81 | delete header['content-type'];
|
82 | delete header['content-length'];
|
83 | delete header['transfer-encoding'];
|
84 | delete header.host;
|
85 | // secuirty
|
86 | if (changesOrigin) {
|
87 | delete header.authorization;
|
88 | delete header.cookie;
|
89 | }
|
90 | return header;
|
91 | };
|
92 |
|
93 | /**
|
94 | * Check if `obj` is an object.
|
95 | *
|
96 | * @param {Object} object
|
97 | * @return {Boolean}
|
98 | * @api private
|
99 | */
|
100 | exports.isObject = object => {
|
101 | return object !== null && typeof object === 'object';
|
102 | };
|
103 |
|
104 | /**
|
105 | * Object.hasOwn fallback/polyfill.
|
106 | *
|
107 | * @type {(object: object, property: string) => boolean} object
|
108 | * @api private
|
109 | */
|
110 | exports.hasOwn = Object.hasOwn || function (object, property) {
|
111 | if (object == null) {
|
112 | throw new TypeError('Cannot convert undefined or null to object');
|
113 | }
|
114 | return Object.prototype.hasOwnProperty.call(new Object(object), property);
|
115 | };
|
116 | exports.mixin = (target, source) => {
|
117 | for (const key in source) {
|
118 | if (exports.hasOwn(source, key)) {
|
119 | target[key] = source[key];
|
120 | }
|
121 | }
|
122 | };
|
123 | //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJleHBvcnRzIiwidHlwZSIsInN0cmluZ18iLCJzcGxpdCIsInNoaWZ0IiwicGFyYW1zIiwidmFsdWUiLCJvYmplY3QiLCJwYXJ0cyIsImtleSIsInBhcnNlTGlua3MiLCJ1cmwiLCJzbGljZSIsInJlbCIsImNsZWFuSGVhZGVyIiwiaGVhZGVyIiwiY2hhbmdlc09yaWdpbiIsImhvc3QiLCJhdXRob3JpemF0aW9uIiwiY29va2llIiwiaXNPYmplY3QiLCJoYXNPd24iLCJPYmplY3QiLCJwcm9wZXJ0eSIsIlR5cGVFcnJvciIsInByb3RvdHlwZSIsImhhc093blByb3BlcnR5IiwiY2FsbCIsIm1peGluIiwidGFyZ2V0Iiwic291cmNlIl0sInNvdXJjZXMiOlsiLi4vc3JjL3V0aWxzLmpzIl0sInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogUmV0dXJuIHRoZSBtaW1lIHR5cGUgZm9yIHRoZSBnaXZlbiBgc3RyYC5cbiAqXG4gKiBAcGFyYW0ge1N0cmluZ30gc3RyXG4gKiBAcmV0dXJuIHtTdHJpbmd9XG4gKiBAYXBpIHByaXZhdGVcbiAqL1xuXG5leHBvcnRzLnR5cGUgPSAoc3RyaW5nXykgPT4gc3RyaW5nXy5zcGxpdCgvICo7ICovKS5zaGlmdCgpO1xuXG4vKipcbiAqIFJldHVybiBoZWFkZXIgZmllbGQgcGFyYW1ldGVycy5cbi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