@builder.io/sdk 3.0.0 → 3.0.2-0

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.
Files changed (34) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/index.browser.js +6 -3
  3. package/dist/index.browser.js.map +1 -1
  4. package/dist/index.cjs.js +6 -3
  5. package/dist/index.cjs.js.map +1 -1
  6. package/dist/index.esm.js +6 -3
  7. package/dist/index.esm.js.map +1 -1
  8. package/dist/index.umd.js +6 -3
  9. package/dist/index.umd.js.map +1 -1
  10. package/dist/package.json +3 -2
  11. package/dist/src/builder.class.d.ts +2 -1
  12. package/dist/src/builder.class.js +5 -2
  13. package/dist/src/builder.class.js.map +1 -1
  14. package/dist/src/builder.class.test.js +5 -5
  15. package/dist/src/builder.class.test.js.map +1 -1
  16. package/dist/src/classes/promise.class.js +150 -154
  17. package/dist/src/classes/query-string.class.js +73 -74
  18. package/dist/src/classes/query-string.class.test.js +20 -20
  19. package/dist/src/functions/assign.function.js +19 -19
  20. package/dist/src/functions/fetch.function.js +97 -75
  21. package/dist/src/functions/finder.function.js +389 -274
  22. package/dist/src/functions/get-top-level-domain.js +8 -8
  23. package/dist/src/functions/next-tick.function.js +26 -23
  24. package/dist/src/functions/omit.function.js +13 -13
  25. package/dist/src/functions/server-only-require.function.js +10 -9
  26. package/dist/src/functions/throttle.function.js +35 -37
  27. package/dist/src/functions/to-error.js +5 -6
  28. package/dist/src/functions/uuid.js +9 -8
  29. package/dist/src/types/api-version.js +3 -3
  30. package/dist/src/types/element.js +3 -3
  31. package/dist/src/url.test.js +222 -118
  32. package/dist/tsconfig.tsbuildinfo +1 -1
  33. package/package.json +4 -3
  34. package/.yarnrc.yml +0 -1
@@ -1,5 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ 'use strict';
2
+ Object.defineProperty(exports, '__esModule', { value: true });
3
3
  exports.getTopLevelDomain = void 0;
4
4
  /**
5
5
  * Only gets one level up from hostname
@@ -7,11 +7,11 @@ exports.getTopLevelDomain = void 0;
7
7
  * www.example.co.uk -> example.co.uk
8
8
  */
9
9
  function getTopLevelDomain(host) {
10
- var parts = host.split('.');
11
- if (parts.length > 2) {
12
- return parts.slice(1).join('.');
13
- }
14
- return host;
10
+ var parts = host.split('.');
11
+ if (parts.length > 2) {
12
+ return parts.slice(1).join('.');
13
+ }
14
+ return host;
15
15
  }
16
16
  exports.getTopLevelDomain = getTopLevelDomain;
17
- //# sourceMappingURL=get-top-level-domain.js.map
17
+ //# sourceMappingURL=get-top-level-domain.js.map
@@ -1,29 +1,32 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ 'use strict';
2
+ Object.defineProperty(exports, '__esModule', { value: true });
3
3
  exports.nextTick = void 0;
4
- var isSafari = typeof window !== 'undefined' &&
5
- /^((?!chrome|android).)*safari/i.test(window.navigator.userAgent);
4
+ var isSafari =
5
+ typeof window !== 'undefined' &&
6
+ /^((?!chrome|android).)*safari/i.test(window.navigator.userAgent);
6
7
  var isClient = typeof window !== 'undefined';
7
8
  // TODO: queue all of these in a debounceNextTick
8
9
  function nextTick(fn) {
9
- // if (typeof process !== 'undefined' && process.nextTick) {
10
- // console.log('process.nextTick?');
11
- // process.nextTick(fn);
12
- // return;
13
- // }
14
- // FIXME: fix the real safari issue of this randomly not working
15
- if (!isClient || isSafari || typeof MutationObserver === 'undefined') {
16
- setTimeout(fn);
17
- return;
18
- }
19
- var called = 0;
20
- var observer = new MutationObserver(function () { return fn(); });
21
- var element = document.createTextNode('');
22
- observer.observe(element, {
23
- characterData: true,
24
- });
25
- // tslint:disable-next-line
26
- element.data = String((called = ++called));
10
+ // if (typeof process !== 'undefined' && process.nextTick) {
11
+ // console.log('process.nextTick?');
12
+ // process.nextTick(fn);
13
+ // return;
14
+ // }
15
+ // FIXME: fix the real safari issue of this randomly not working
16
+ if (!isClient || isSafari || typeof MutationObserver === 'undefined') {
17
+ setTimeout(fn);
18
+ return;
19
+ }
20
+ var called = 0;
21
+ var observer = new MutationObserver(function () {
22
+ return fn();
23
+ });
24
+ var element = document.createTextNode('');
25
+ observer.observe(element, {
26
+ characterData: true,
27
+ });
28
+ // tslint:disable-next-line
29
+ element.data = String((called = ++called));
27
30
  }
28
31
  exports.nextTick = nextTick;
29
- //# sourceMappingURL=next-tick.function.js.map
32
+ //# sourceMappingURL=next-tick.function.js.map
@@ -1,17 +1,17 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ 'use strict';
2
+ Object.defineProperty(exports, '__esModule', { value: true });
3
3
  exports.omit = void 0;
4
4
  function omit(obj) {
5
- var values = [];
6
- for (var _i = 1; _i < arguments.length; _i++) {
7
- values[_i - 1] = arguments[_i];
8
- }
9
- var newObject = Object.assign({}, obj);
10
- for (var _a = 0, values_1 = values; _a < values_1.length; _a++) {
11
- var key = values_1[_a];
12
- delete newObject[key];
13
- }
14
- return newObject;
5
+ var values = [];
6
+ for (var _i = 1; _i < arguments.length; _i++) {
7
+ values[_i - 1] = arguments[_i];
8
+ }
9
+ var newObject = Object.assign({}, obj);
10
+ for (var _a = 0, values_1 = values; _a < values_1.length; _a++) {
11
+ var key = values_1[_a];
12
+ delete newObject[key];
13
+ }
14
+ return newObject;
15
15
  }
16
16
  exports.omit = omit;
17
- //# sourceMappingURL=omit.function.js.map
17
+ //# sourceMappingURL=omit.function.js.map
@@ -1,15 +1,16 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ 'use strict';
2
+ Object.defineProperty(exports, '__esModule', { value: true });
3
3
  // Webpack workaround to conditionally require certain external modules
4
4
  // only on the server and not bundle them on the client
5
5
  var serverOnlyRequire;
6
6
  try {
7
- // tslint:disable-next-line:no-eval
8
- serverOnlyRequire = eval('require');
9
- }
10
- catch (err) {
11
- // all good
12
- serverOnlyRequire = (function () { return null; });
7
+ // tslint:disable-next-line:no-eval
8
+ serverOnlyRequire = eval('require');
9
+ } catch (err) {
10
+ // all good
11
+ serverOnlyRequire = function () {
12
+ return null;
13
+ };
13
14
  }
14
15
  exports.default = serverOnlyRequire;
15
- //# sourceMappingURL=server-only-require.function.js.map
16
+ //# sourceMappingURL=server-only-require.function.js.map
@@ -1,42 +1,40 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ 'use strict';
2
+ Object.defineProperty(exports, '__esModule', { value: true });
3
3
  exports.throttle = void 0;
4
4
  function throttle(func, wait, options) {
5
- if (options === void 0) { options = {}; }
6
- var context;
7
- var args;
8
- var result;
9
- var timeout = null;
10
- var previous = 0;
11
- var later = function () {
12
- previous = options.leading === false ? 0 : Date.now();
5
+ if (options === void 0) {
6
+ options = {};
7
+ }
8
+ var context;
9
+ var args;
10
+ var result;
11
+ var timeout = null;
12
+ var previous = 0;
13
+ var later = function () {
14
+ previous = options.leading === false ? 0 : Date.now();
15
+ timeout = null;
16
+ result = func.apply(context, args);
17
+ if (!timeout) context = args = null;
18
+ };
19
+ return function () {
20
+ var now = Date.now();
21
+ if (!previous && options.leading === false) previous = now;
22
+ var remaining = wait - (now - previous);
23
+ context = this;
24
+ args = arguments;
25
+ if (remaining <= 0 || remaining > wait) {
26
+ if (timeout) {
27
+ clearTimeout(timeout);
13
28
  timeout = null;
14
- result = func.apply(context, args);
15
- if (!timeout)
16
- context = args = null;
17
- };
18
- return function () {
19
- var now = Date.now();
20
- if (!previous && options.leading === false)
21
- previous = now;
22
- var remaining = wait - (now - previous);
23
- context = this;
24
- args = arguments;
25
- if (remaining <= 0 || remaining > wait) {
26
- if (timeout) {
27
- clearTimeout(timeout);
28
- timeout = null;
29
- }
30
- previous = now;
31
- result = func.apply(context, args);
32
- if (!timeout)
33
- context = args = null;
34
- }
35
- else if (!timeout && options.trailing !== false) {
36
- timeout = setTimeout(later, remaining);
37
- }
38
- return result;
39
- };
29
+ }
30
+ previous = now;
31
+ result = func.apply(context, args);
32
+ if (!timeout) context = args = null;
33
+ } else if (!timeout && options.trailing !== false) {
34
+ timeout = setTimeout(later, remaining);
35
+ }
36
+ return result;
37
+ };
40
38
  }
41
39
  exports.throttle = throttle;
42
- //# sourceMappingURL=throttle.function.js.map
40
+ //# sourceMappingURL=throttle.function.js.map
@@ -1,5 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ 'use strict';
2
+ Object.defineProperty(exports, '__esModule', { value: true });
3
3
  exports.toError = void 0;
4
4
  /**
5
5
  * Safe conversion to error type. Intended to be used in catch blocks where the
@@ -14,9 +14,8 @@ exports.toError = void 0;
14
14
  * }
15
15
  */
16
16
  function toError(err) {
17
- if (err instanceof Error)
18
- return err;
19
- return new Error(String(err));
17
+ if (err instanceof Error) return err;
18
+ return new Error(String(err));
20
19
  }
21
20
  exports.toError = toError;
22
- //# sourceMappingURL=to-error.js.map
21
+ //# sourceMappingURL=to-error.js.map
@@ -1,21 +1,22 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ 'use strict';
2
+ Object.defineProperty(exports, '__esModule', { value: true });
3
3
  exports.uuid = exports.uuidv4 = void 0;
4
4
  /**
5
5
  * @credit https://stackoverflow.com/a/2117523
6
6
  */
7
7
  function uuidv4() {
8
- return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
9
- var r = (Math.random() * 16) | 0, v = c == 'x' ? r : (r & 0x3) | 0x8;
10
- return v.toString(16);
11
- });
8
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
9
+ var r = (Math.random() * 16) | 0,
10
+ v = c == 'x' ? r : (r & 0x3) | 0x8;
11
+ return v.toString(16);
12
+ });
12
13
  }
13
14
  exports.uuidv4 = uuidv4;
14
15
  /**
15
16
  * Slightly cleaner and smaller UUIDs
16
17
  */
17
18
  function uuid() {
18
- return uuidv4().replace(/-/g, '');
19
+ return uuidv4().replace(/-/g, '');
19
20
  }
20
21
  exports.uuid = uuid;
21
- //# sourceMappingURL=uuid.js.map
22
+ //# sourceMappingURL=uuid.js.map
@@ -1,5 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ 'use strict';
2
+ Object.defineProperty(exports, '__esModule', { value: true });
3
3
  exports.DEFAULT_API_VERSION = void 0;
4
4
  exports.DEFAULT_API_VERSION = 'v3';
5
- //# sourceMappingURL=api-version.js.map
5
+ //# sourceMappingURL=api-version.js.map
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=element.js.map
1
+ 'use strict';
2
+ Object.defineProperty(exports, '__esModule', { value: true });
3
+ //# sourceMappingURL=element.js.map
@@ -1,129 +1,233 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
1
+ 'use strict';
2
+ var __awaiter =
3
+ (this && this.__awaiter) ||
4
+ function (thisArg, _arguments, P, generator) {
5
+ function adopt(value) {
6
+ return value instanceof P
7
+ ? value
8
+ : new P(function (resolve) {
9
+ resolve(value);
10
+ });
11
+ }
4
12
  return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
13
+ function fulfilled(value) {
14
+ try {
15
+ step(generator.next(value));
16
+ } catch (e) {
17
+ reject(e);
18
+ }
19
+ }
20
+ function rejected(value) {
21
+ try {
22
+ step(generator['throw'](value));
23
+ } catch (e) {
24
+ reject(e);
25
+ }
26
+ }
27
+ function step(result) {
28
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
29
+ }
30
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
31
  });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
32
+ };
33
+ var __generator =
34
+ (this && this.__generator) ||
35
+ function (thisArg, body) {
36
+ var _ = {
37
+ label: 0,
38
+ sent: function () {
39
+ if (t[0] & 1) throw t[1];
40
+ return t[1];
41
+ },
42
+ trys: [],
43
+ ops: [],
44
+ },
45
+ f,
46
+ y,
47
+ t,
48
+ g;
49
+ return (
50
+ (g = { next: verb(0), throw: verb(1), return: verb(2) }),
51
+ typeof Symbol === 'function' &&
52
+ (g[Symbol.iterator] = function () {
53
+ return this;
54
+ }),
55
+ g
56
+ );
57
+ function verb(n) {
58
+ return function (v) {
59
+ return step([n, v]);
60
+ };
61
+ }
15
62
  function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
63
+ if (f) throw new TypeError('Generator is already executing.');
64
+ while ((g && ((g = 0), op[0] && (_ = 0)), _))
65
+ try {
66
+ if (
67
+ ((f = 1),
68
+ y &&
69
+ (t =
70
+ op[0] & 2
71
+ ? y['return']
72
+ : op[0]
73
+ ? y['throw'] || ((t = y['return']) && t.call(y), 0)
74
+ : y.next) &&
75
+ !(t = t.call(y, op[1])).done)
76
+ )
77
+ return t;
78
+ if (((y = 0), t)) op = [op[0] & 2, t.value];
79
+ switch (op[0]) {
80
+ case 0:
81
+ case 1:
82
+ t = op;
83
+ break;
84
+ case 4:
85
+ _.label++;
86
+ return { value: op[1], done: false };
87
+ case 5:
88
+ _.label++;
89
+ y = op[1];
90
+ op = [0];
91
+ continue;
92
+ case 7:
93
+ op = _.ops.pop();
94
+ _.trys.pop();
95
+ continue;
96
+ default:
97
+ if (
98
+ !((t = _.trys), (t = t.length > 0 && t[t.length - 1])) &&
99
+ (op[0] === 6 || op[0] === 2)
100
+ ) {
101
+ _ = 0;
102
+ continue;
103
+ }
104
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
105
+ _.label = op[1];
106
+ break;
107
+ }
108
+ if (op[0] === 6 && _.label < t[1]) {
109
+ _.label = t[1];
110
+ t = op;
111
+ break;
112
+ }
113
+ if (t && _.label < t[2]) {
114
+ _.label = t[2];
115
+ _.ops.push(op);
116
+ break;
117
+ }
118
+ if (t[2]) _.ops.pop();
119
+ _.trys.pop();
120
+ continue;
121
+ }
122
+ op = body.call(thisArg, _);
123
+ } catch (e) {
124
+ op = [6, e];
125
+ y = 0;
126
+ } finally {
127
+ f = t = 0;
128
+ }
129
+ if (op[0] & 5) throw op[1];
130
+ return { value: op[0] ? op[1] : void 0, done: true };
36
131
  }
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- var url_1 = require("./url");
40
- var url_2 = require("url");
132
+ };
133
+ Object.defineProperty(exports, '__esModule', { value: true });
134
+ var url_1 = require('./url');
135
+ var url_2 = require('url');
41
136
  describe('.parse', function () {
42
- test('can parse a full url', function () { return __awaiter(void 0, void 0, void 0, function () {
43
- return __generator(this, function (_a) {
44
- expect((0, url_1.parse)('http://example.com/foo/bar?q=1')).toEqual({
45
- auth: null,
46
- hash: null,
47
- host: 'example.com',
48
- hostname: 'example.com',
49
- href: 'http://example.com/foo/bar?q=1',
50
- path: '/foo/bar?q=1',
51
- pathname: '/foo/bar',
52
- port: null,
53
- protocol: 'http:',
54
- query: 'q=1',
55
- search: '?q=1',
56
- slashes: true,
57
- });
58
- return [2 /*return*/];
137
+ test('can parse a full url', function () {
138
+ return __awaiter(void 0, void 0, void 0, function () {
139
+ return __generator(this, function (_a) {
140
+ expect((0, url_1.parse)('http://example.com/foo/bar?q=1')).toEqual({
141
+ auth: null,
142
+ hash: null,
143
+ host: 'example.com',
144
+ hostname: 'example.com',
145
+ href: 'http://example.com/foo/bar?q=1',
146
+ path: '/foo/bar?q=1',
147
+ pathname: '/foo/bar',
148
+ port: null,
149
+ protocol: 'http:',
150
+ query: 'q=1',
151
+ search: '?q=1',
152
+ slashes: true,
59
153
  });
60
- }); });
61
- test('can parse a path', function () { return __awaiter(void 0, void 0, void 0, function () {
62
- return __generator(this, function (_a) {
63
- expect((0, url_1.parse)('/foo/bar?q=1')).toEqual({
64
- auth: null,
65
- hash: null,
66
- host: null,
67
- hostname: null,
68
- href: '/foo/bar?q=1',
69
- path: '/foo/bar?q=1',
70
- pathname: '/foo/bar',
71
- port: null,
72
- protocol: null,
73
- query: 'q=1',
74
- search: '?q=1',
75
- slashes: null,
76
- });
77
- return [2 /*return*/];
154
+ return [2 /*return*/];
155
+ });
156
+ });
157
+ });
158
+ test('can parse a path', function () {
159
+ return __awaiter(void 0, void 0, void 0, function () {
160
+ return __generator(this, function (_a) {
161
+ expect((0, url_1.parse)('/foo/bar?q=1')).toEqual({
162
+ auth: null,
163
+ hash: null,
164
+ host: null,
165
+ hostname: null,
166
+ href: '/foo/bar?q=1',
167
+ path: '/foo/bar?q=1',
168
+ pathname: '/foo/bar',
169
+ port: null,
170
+ protocol: null,
171
+ query: 'q=1',
172
+ search: '?q=1',
173
+ slashes: null,
78
174
  });
79
- }); });
80
- test('can parse a url that is missing slashes', function () { return __awaiter(void 0, void 0, void 0, function () {
81
- return __generator(this, function (_a) {
82
- expect((0, url_1.parse)('http:example.com/foo/bar?q=1')).toEqual({
83
- auth: null,
84
- hash: null,
85
- host: 'example.com',
86
- hostname: 'example.com',
87
- href: 'http://example.com/foo/bar?q=1',
88
- path: '/foo/bar?q=1',
89
- pathname: '/foo/bar',
90
- port: null,
91
- protocol: 'http:',
92
- query: 'q=1',
93
- search: '?q=1',
94
- slashes: false,
95
- });
96
- return [2 /*return*/];
175
+ return [2 /*return*/];
176
+ });
177
+ });
178
+ });
179
+ test('can parse a url that is missing slashes', function () {
180
+ return __awaiter(void 0, void 0, void 0, function () {
181
+ return __generator(this, function (_a) {
182
+ expect((0, url_1.parse)('http:example.com/foo/bar?q=1')).toEqual({
183
+ auth: null,
184
+ hash: null,
185
+ host: 'example.com',
186
+ hostname: 'example.com',
187
+ href: 'http://example.com/foo/bar?q=1',
188
+ path: '/foo/bar?q=1',
189
+ pathname: '/foo/bar',
190
+ port: null,
191
+ protocol: 'http:',
192
+ query: 'q=1',
193
+ search: '?q=1',
194
+ slashes: false,
97
195
  });
98
- }); });
99
- describe('behaves the same as the old query function', function () {
100
- describe.each([{ url: '/foo/bar?a=1&b=2' }, { url: 'http://example.com/foo/bar?a=1&b=2' }])('with url `$url`', function (_a) {
101
- var url = _a.url;
102
- var expected = Object.assign({}, (0, url_2.parse)(url));
103
- var actual = (0, url_1.parse)(url);
104
- test.each([
105
- { prop: 'query' },
106
- { prop: 'port' },
107
- { prop: 'auth' },
108
- { prop: 'hash' },
109
- { prop: 'host' },
110
- { prop: 'hostname' },
111
- { prop: 'href' },
112
- { prop: 'path' },
113
- { prop: 'pathname' },
114
- { prop: 'protocol' },
115
- { prop: 'search' },
116
- { prop: 'slashes' },
117
- ])('`$prop` is the same', function (_a) {
118
- var prop = _a.prop;
119
- return __awaiter(void 0, void 0, void 0, function () {
120
- return __generator(this, function (_b) {
121
- expect(actual[prop]).toEqual(expected[prop]);
122
- return [2 /*return*/];
123
- });
124
- });
196
+ return [2 /*return*/];
197
+ });
198
+ });
199
+ });
200
+ describe('behaves the same as the old query function', function () {
201
+ describe.each([{ url: '/foo/bar?a=1&b=2' }, { url: 'http://example.com/foo/bar?a=1&b=2' }])(
202
+ 'with url `$url`',
203
+ function (_a) {
204
+ var url = _a.url;
205
+ var expected = Object.assign({}, (0, url_2.parse)(url));
206
+ var actual = (0, url_1.parse)(url);
207
+ test.each([
208
+ { prop: 'query' },
209
+ { prop: 'port' },
210
+ { prop: 'auth' },
211
+ { prop: 'hash' },
212
+ { prop: 'host' },
213
+ { prop: 'hostname' },
214
+ { prop: 'href' },
215
+ { prop: 'path' },
216
+ { prop: 'pathname' },
217
+ { prop: 'protocol' },
218
+ { prop: 'search' },
219
+ { prop: 'slashes' },
220
+ ])('`$prop` is the same', function (_a) {
221
+ var prop = _a.prop;
222
+ return __awaiter(void 0, void 0, void 0, function () {
223
+ return __generator(this, function (_b) {
224
+ expect(actual[prop]).toEqual(expected[prop]);
225
+ return [2 /*return*/];
125
226
  });
227
+ });
126
228
  });
127
- });
229
+ }
230
+ );
231
+ });
128
232
  });
129
- //# sourceMappingURL=url.test.js.map
233
+ //# sourceMappingURL=url.test.js.map