@uxf/resizer 11.11.3 → 11.20.1
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/package.json
CHANGED
|
@@ -3,6 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.parseHttpSource = void 0;
|
|
4
4
|
function parseHttpSource(source) {
|
|
5
5
|
var _a;
|
|
6
|
-
return (_a = /^(?<protocol>http|https):\/\/(?<domain
|
|
6
|
+
return (_a = /^(?<protocol>http|https):\/\/(?<domain>[^/]*)\/(?<path>.*)$/.exec(source)) === null || _a === void 0 ? void 0 : _a.groups;
|
|
7
7
|
}
|
|
8
8
|
exports.parseHttpSource = parseHttpSource;
|
|
@@ -12,6 +12,11 @@ test("parse source", () => {
|
|
|
12
12
|
domain: "localhost:3000",
|
|
13
13
|
path: ":filename+.:extension",
|
|
14
14
|
});
|
|
15
|
+
expect((0, parse_http_source_1.parseHttpSource)("http://localhost:3000/test/:filename+.:extension")).toEqual({
|
|
16
|
+
protocol: "http",
|
|
17
|
+
domain: "localhost:3000",
|
|
18
|
+
path: "test/:filename+.:extension",
|
|
19
|
+
});
|
|
15
20
|
expect((0, parse_http_source_1.parseHttpSource)("https://:url/:filename+.:extension")).toEqual({
|
|
16
21
|
protocol: "https",
|
|
17
22
|
domain: ":url",
|
|
@@ -11,6 +11,11 @@ test("parse source", () => {
|
|
|
11
11
|
domain: "localhost:3000",
|
|
12
12
|
path: ":filename+.:extension",
|
|
13
13
|
});
|
|
14
|
+
expect(parseHttpSource("http://localhost:3000/test/:filename+.:extension")).toEqual({
|
|
15
|
+
protocol: "http",
|
|
16
|
+
domain: "localhost:3000",
|
|
17
|
+
path: "test/:filename+.:extension",
|
|
18
|
+
});
|
|
14
19
|
expect(parseHttpSource("https://:url/:filename+.:extension")).toEqual({
|
|
15
20
|
protocol: "https",
|
|
16
21
|
domain: ":url",
|
|
@@ -5,5 +5,5 @@ interface Result {
|
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
export function parseHttpSource(source: string): Result | undefined {
|
|
8
|
-
return /^(?<protocol>http|https):\/\/(?<domain
|
|
8
|
+
return /^(?<protocol>http|https):\/\/(?<domain>[^/]*)\/(?<path>.*)$/.exec(source)?.groups as Result | undefined;
|
|
9
9
|
}
|