inferred-types 0.50.3 → 0.50.6
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/dist/constants/ISO3166.d.ts +1001 -0
- package/dist/constants/ISO3166.d.ts.map +1 -0
- package/dist/constants/ISO3166.js +6 -0
- package/dist/constants/Retail.d.ts +27 -0
- package/dist/constants/Retail.d.ts.map +1 -0
- package/dist/constants/Retail.js +89 -0
- package/dist/constants/index.d.ts +2 -0
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/constants/index.js +2 -0
- package/dist/constants/tsconfig.tsbuildinfo +1 -1
- package/dist/index.cjs +581 -13
- package/dist/index.js +523 -13
- package/dist/inferred-types/tsconfig.tsbuildinfo +1 -1
- package/dist/runtime/tsconfig.tsbuildinfo +1 -1
- package/dist/runtime/type-guards/countries/index.d.ts +2 -0
- package/dist/runtime/type-guards/countries/index.d.ts.map +1 -0
- package/dist/runtime/type-guards/countries/index.js +1 -0
- package/dist/runtime/type-guards/countries/isIso3166Alpha2.d.ts +7 -0
- package/dist/runtime/type-guards/countries/isIso3166Alpha2.d.ts.map +1 -0
- package/dist/runtime/type-guards/countries/isIso3166Alpha2.js +10 -0
- package/dist/runtime/type-guards/github.d.ts +95 -0
- package/dist/runtime/type-guards/github.d.ts.map +1 -0
- package/dist/runtime/type-guards/github.js +139 -0
- package/dist/runtime/type-guards/index.d.ts +3 -0
- package/dist/runtime/type-guards/index.d.ts.map +1 -1
- package/dist/runtime/type-guards/index.js +3 -0
- package/dist/runtime/type-guards/isUrl.d.ts +1 -1
- package/dist/runtime/type-guards/isUrl.d.ts.map +1 -1
- package/dist/runtime/type-guards/repos.d.ts +1 -14
- package/dist/runtime/type-guards/repos.d.ts.map +1 -1
- package/dist/runtime/type-guards/repos.js +0 -21
- package/dist/runtime/type-guards/retail.d.ts +107 -0
- package/dist/runtime/type-guards/retail.d.ts.map +1 -0
- package/dist/runtime/type-guards/retail.js +149 -0
- package/dist/runtime/type-guards/youtube.d.ts +28 -0
- package/dist/runtime/type-guards/youtube.d.ts.map +1 -1
- package/dist/runtime/type-guards/youtube.js +41 -1
- package/dist/types/string-literals/character-sets/Country.d.ts +20 -0
- package/dist/types/string-literals/character-sets/Country.d.ts.map +1 -0
- package/dist/types/string-literals/character-sets/Country.js +1 -0
- package/dist/types/string-literals/character-sets/Github.d.ts +113 -0
- package/dist/types/string-literals/character-sets/Github.d.ts.map +1 -0
- package/dist/types/string-literals/character-sets/Github.js +1 -0
- package/dist/types/string-literals/character-sets/Repos.d.ts +2 -74
- package/dist/types/string-literals/character-sets/Repos.d.ts.map +1 -1
- package/dist/types/string-literals/character-sets/Url.d.ts +9 -1
- package/dist/types/string-literals/character-sets/Url.d.ts.map +1 -1
- package/dist/types/string-literals/character-sets/index.d.ts +3 -0
- package/dist/types/string-literals/character-sets/index.d.ts.map +1 -1
- package/dist/types/string-literals/character-sets/index.js +3 -0
- package/dist/types/string-literals/character-sets/retail-urls.d.ts +26 -0
- package/dist/types/string-literals/character-sets/retail-urls.d.ts.map +1 -0
- package/dist/types/string-literals/character-sets/retail-urls.js +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/runtime/type-guards/countries/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./isIso3166Alpha2";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Iso3166_1 } from "src/types/index";
|
|
2
|
+
/**
|
|
3
|
+
* Type guard which checks whether `val` is a 2 character country
|
|
4
|
+
* representation found in the ISO3166-1 standard.
|
|
5
|
+
*/
|
|
6
|
+
export declare const isIso3166Alpha2: (val: unknown) => val is Iso3166_1;
|
|
7
|
+
//# sourceMappingURL=isIso3166Alpha2.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isIso3166Alpha2.d.ts","sourceRoot":"","sources":["../../../../src/runtime/type-guards/countries/isIso3166Alpha2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C;;;GAGG;AACH,eAAO,MAAM,eAAe,QAAS,OAAO,KAAG,GAAG,IAAI,SAGrD,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { isString } from "../isString";
|
|
2
|
+
import { ISO3166_1 } from "src/constants/ISO3166";
|
|
3
|
+
/**
|
|
4
|
+
* Type guard which checks whether `val` is a 2 character country
|
|
5
|
+
* representation found in the ISO3166-1 standard.
|
|
6
|
+
*/
|
|
7
|
+
export const isIso3166Alpha2 = (val) => {
|
|
8
|
+
const codes = ISO3166_1.map(i => i["alpha-2"]);
|
|
9
|
+
return isString(val) && codes.includes(val);
|
|
10
|
+
};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { GithubOrgUrl, GithubRepoIssuesListUrl, GithubRepoIssueUrl, GithubRepoProjectsUrl, GithubRepoProjectUrl, GithubRepoReleasesUrl, GithubRepoReleaseTagUrl, GithubRepoUrl, GithubUrl } from "src/types/string-literals";
|
|
2
|
+
/**
|
|
3
|
+
* **isGithubUrl**`(val)`
|
|
4
|
+
*
|
|
5
|
+
* Type guard which validates that the passed in value is a valid
|
|
6
|
+
* **Github** URL.
|
|
7
|
+
*/
|
|
8
|
+
export declare const isGithubUrl: <T>(val: T) => val is GithubUrl & T;
|
|
9
|
+
/**
|
|
10
|
+
* **isGithubOrgUrl**`(val)`
|
|
11
|
+
*
|
|
12
|
+
* Type guard which validates that the passed in value is a valid
|
|
13
|
+
* **Github** _organization_ URL.
|
|
14
|
+
*/
|
|
15
|
+
export declare const isGithubOrgUrl: <T>(val: T) => val is GithubOrgUrl & T;
|
|
16
|
+
/**
|
|
17
|
+
* **isGithubRepoUrl**`(val)`
|
|
18
|
+
*
|
|
19
|
+
* Type guard which validates that the passed in value is a valid
|
|
20
|
+
* **Github** _repo_ URL.
|
|
21
|
+
*/
|
|
22
|
+
export declare const isGithubRepoUrl: <T>(val: T) => val is GithubRepoUrl & T;
|
|
23
|
+
/**
|
|
24
|
+
* **isGithubRepoReleasesUrl**`(val)`
|
|
25
|
+
*
|
|
26
|
+
* Type guard which validates that the passed in value is a valid
|
|
27
|
+
* URL for the _releases_ of a given _repo_.
|
|
28
|
+
*
|
|
29
|
+
* **Related:** `isGithubRepoReleaseTagUrl`
|
|
30
|
+
*/
|
|
31
|
+
export declare const isGithubRepoReleasesUrl: <T>(val: T) => val is GithubRepoReleasesUrl & T;
|
|
32
|
+
/**
|
|
33
|
+
* **isGithubRepoReleaseTagUrl**`(val)`
|
|
34
|
+
*
|
|
35
|
+
* Type guard which validates that the passed in value is a valid
|
|
36
|
+
* URL for the _releases_ of a given _repo_.
|
|
37
|
+
*
|
|
38
|
+
* **Related:** `isGithubRepoReleasesUrl`
|
|
39
|
+
*/
|
|
40
|
+
export declare const isGithubRepoReleaseTagUrl: <T>(val: T) => val is GithubRepoReleaseTagUrl & T;
|
|
41
|
+
/**
|
|
42
|
+
* **isGithubIssuesListUrl**`(val)`
|
|
43
|
+
*
|
|
44
|
+
* Type guard which validates that the passed in value is a valid
|
|
45
|
+
* URL for the _issues_ of a given _repo_.
|
|
46
|
+
*
|
|
47
|
+
* **Related:** `isGithubIssueUrl`
|
|
48
|
+
*/
|
|
49
|
+
export declare const isGithubIssuesListUrl: <T>(val: T) => val is GithubRepoIssuesListUrl & T;
|
|
50
|
+
/**
|
|
51
|
+
* **isGithubIssueUrl**`(val)`
|
|
52
|
+
*
|
|
53
|
+
* Type guard which validates that the passed in value is a valid
|
|
54
|
+
* URL for the _issues_ of a given _repo_.
|
|
55
|
+
*
|
|
56
|
+
* **Related:** `isGithubIssuesListUrl`
|
|
57
|
+
*/
|
|
58
|
+
export declare const isGithubIssueUrl: <T>(val: T) => val is GithubRepoIssueUrl & T;
|
|
59
|
+
/**
|
|
60
|
+
* **isGithubProjectsListUrl**`(val)`
|
|
61
|
+
*
|
|
62
|
+
* Type guard which validates that the passed in value is a valid
|
|
63
|
+
* URL for the _projects_ of a given _repo_.
|
|
64
|
+
*
|
|
65
|
+
* **Related:** `isGithubProjectUrl`
|
|
66
|
+
*/
|
|
67
|
+
export declare const isGithubProjectsListUrl: <T>(val: T) => val is GithubRepoProjectsUrl & T;
|
|
68
|
+
/**
|
|
69
|
+
* **isGithubProjectUrl**`(val)`
|
|
70
|
+
*
|
|
71
|
+
* Type guard which validates that the passed in value is a valid
|
|
72
|
+
* URL for a _specific project_ of a given _repo_.
|
|
73
|
+
*
|
|
74
|
+
* **Related:** `isGithubProjectsListUrl`
|
|
75
|
+
*/
|
|
76
|
+
export declare const isGithubProjectUrl: <T>(val: T) => val is GithubRepoProjectUrl & T;
|
|
77
|
+
/**
|
|
78
|
+
* **isGithubReleasesListUrl**`(val)`
|
|
79
|
+
*
|
|
80
|
+
* Type guard which validates that the passed in value is a valid
|
|
81
|
+
* URL for the _Releases_ of a given _repo_.
|
|
82
|
+
*
|
|
83
|
+
* **Related:** `isGithubReleaseTagUrl`
|
|
84
|
+
*/
|
|
85
|
+
export declare const isGithubReleasesListUrl: <T>(val: T) => val is GithubRepoReleasesUrl & T;
|
|
86
|
+
/**
|
|
87
|
+
* **isGithubReleaseTagUrl**`(val)`
|
|
88
|
+
*
|
|
89
|
+
* Type guard which validates that the passed in value is a valid
|
|
90
|
+
* URL for a _specific release_ of a given _repo_.
|
|
91
|
+
*
|
|
92
|
+
* **Related:** `isGithubReleasesListUrl`
|
|
93
|
+
*/
|
|
94
|
+
export declare const isGithubReleaseTagUrl: <T>(val: T) => val is GithubRepoProjectUrl & T;
|
|
95
|
+
//# sourceMappingURL=github.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../../../src/runtime/type-guards/github.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY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B,GAAG,CAMlF,CAAA;AAGD;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,GAAI,CAAC,OAAO,CAAC,KAAG,GAAG,IAAI,oBAAoB,GAAG,CAM/E,CAAA"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { isString } from "./isString";
|
|
2
|
+
import { stripLeading, stripTrailing } from "../literals";
|
|
3
|
+
/**
|
|
4
|
+
* **isGithubUrl**`(val)`
|
|
5
|
+
*
|
|
6
|
+
* Type guard which validates that the passed in value is a valid
|
|
7
|
+
* **Github** URL.
|
|
8
|
+
*/
|
|
9
|
+
export const isGithubUrl = (val) => {
|
|
10
|
+
return isString(val) && (val.startsWith("https://github.com") ||
|
|
11
|
+
val.startsWith('https://www.github.com') ||
|
|
12
|
+
val.startsWith('https://github.io'));
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* **isGithubOrgUrl**`(val)`
|
|
16
|
+
*
|
|
17
|
+
* Type guard which validates that the passed in value is a valid
|
|
18
|
+
* **Github** _organization_ URL.
|
|
19
|
+
*/
|
|
20
|
+
export const isGithubOrgUrl = (val) => {
|
|
21
|
+
return isString(val) && (val.startsWith("https://github.com/") &&
|
|
22
|
+
stripper(val).length === 2);
|
|
23
|
+
};
|
|
24
|
+
const stripper = (s) => {
|
|
25
|
+
return stripTrailing(stripLeading(s, "https://github.com/"), "/");
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* **isGithubRepoUrl**`(val)`
|
|
29
|
+
*
|
|
30
|
+
* Type guard which validates that the passed in value is a valid
|
|
31
|
+
* **Github** _repo_ URL.
|
|
32
|
+
*/
|
|
33
|
+
export const isGithubRepoUrl = (val) => {
|
|
34
|
+
return isString(val) && (val.startsWith("https://github.com/") &&
|
|
35
|
+
stripper(val).split("/").length === 2) ? true : false;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* **isGithubRepoReleasesUrl**`(val)`
|
|
39
|
+
*
|
|
40
|
+
* Type guard which validates that the passed in value is a valid
|
|
41
|
+
* URL for the _releases_ of a given _repo_.
|
|
42
|
+
*
|
|
43
|
+
* **Related:** `isGithubRepoReleaseTagUrl`
|
|
44
|
+
*/
|
|
45
|
+
export const isGithubRepoReleasesUrl = (val) => {
|
|
46
|
+
return isString(val) && (val.startsWith("https://github.com/") &&
|
|
47
|
+
val.includes("/releases") &&
|
|
48
|
+
stripper(val).split("/").length === 3);
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* **isGithubRepoReleaseTagUrl**`(val)`
|
|
52
|
+
*
|
|
53
|
+
* Type guard which validates that the passed in value is a valid
|
|
54
|
+
* URL for the _releases_ of a given _repo_.
|
|
55
|
+
*
|
|
56
|
+
* **Related:** `isGithubRepoReleasesUrl`
|
|
57
|
+
*/
|
|
58
|
+
export const isGithubRepoReleaseTagUrl = (val) => {
|
|
59
|
+
return isString(val) && (val.startsWith("https://github.com/") &&
|
|
60
|
+
val.includes("/releases/tag/") &&
|
|
61
|
+
stripper(val).length === 4);
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* **isGithubIssuesListUrl**`(val)`
|
|
65
|
+
*
|
|
66
|
+
* Type guard which validates that the passed in value is a valid
|
|
67
|
+
* URL for the _issues_ of a given _repo_.
|
|
68
|
+
*
|
|
69
|
+
* **Related:** `isGithubIssueUrl`
|
|
70
|
+
*/
|
|
71
|
+
export const isGithubIssuesListUrl = (val) => {
|
|
72
|
+
return isString(val) &&
|
|
73
|
+
val.startsWith("https://github.com/") &&
|
|
74
|
+
val.includes("/issues");
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* **isGithubIssueUrl**`(val)`
|
|
78
|
+
*
|
|
79
|
+
* Type guard which validates that the passed in value is a valid
|
|
80
|
+
* URL for the _issues_ of a given _repo_.
|
|
81
|
+
*
|
|
82
|
+
* **Related:** `isGithubIssuesListUrl`
|
|
83
|
+
*/
|
|
84
|
+
export const isGithubIssueUrl = (val) => {
|
|
85
|
+
return isString(val) && (val.startsWith("https://github.com/") &&
|
|
86
|
+
val.includes("/issues/"));
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* **isGithubProjectsListUrl**`(val)`
|
|
90
|
+
*
|
|
91
|
+
* Type guard which validates that the passed in value is a valid
|
|
92
|
+
* URL for the _projects_ of a given _repo_.
|
|
93
|
+
*
|
|
94
|
+
* **Related:** `isGithubProjectUrl`
|
|
95
|
+
*/
|
|
96
|
+
export const isGithubProjectsListUrl = (val) => {
|
|
97
|
+
return isString(val) && (val.startsWith("https://github.com/") &&
|
|
98
|
+
(val.includes("/projects?") || val.trim().endsWith("/projects")) &&
|
|
99
|
+
stripper(val).split("/").length === 3);
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* **isGithubProjectUrl**`(val)`
|
|
103
|
+
*
|
|
104
|
+
* Type guard which validates that the passed in value is a valid
|
|
105
|
+
* URL for a _specific project_ of a given _repo_.
|
|
106
|
+
*
|
|
107
|
+
* **Related:** `isGithubProjectsListUrl`
|
|
108
|
+
*/
|
|
109
|
+
export const isGithubProjectUrl = (val) => {
|
|
110
|
+
return isString(val) && (val.startsWith("https://github.com/") &&
|
|
111
|
+
val.includes("/projects/") &&
|
|
112
|
+
stripper(val).split("/").length === 4);
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* **isGithubReleasesListUrl**`(val)`
|
|
116
|
+
*
|
|
117
|
+
* Type guard which validates that the passed in value is a valid
|
|
118
|
+
* URL for the _Releases_ of a given _repo_.
|
|
119
|
+
*
|
|
120
|
+
* **Related:** `isGithubReleaseTagUrl`
|
|
121
|
+
*/
|
|
122
|
+
export const isGithubReleasesListUrl = (val) => {
|
|
123
|
+
return isString(val) && (val.startsWith("https://github.com/") &&
|
|
124
|
+
(val.includes("/releases?") || val.trim().endsWith("/releases")) &&
|
|
125
|
+
stripper(val).split("/").length === 3);
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
* **isGithubReleaseTagUrl**`(val)`
|
|
129
|
+
*
|
|
130
|
+
* Type guard which validates that the passed in value is a valid
|
|
131
|
+
* URL for a _specific release_ of a given _repo_.
|
|
132
|
+
*
|
|
133
|
+
* **Related:** `isGithubReleasesListUrl`
|
|
134
|
+
*/
|
|
135
|
+
export const isGithubReleaseTagUrl = (val) => {
|
|
136
|
+
return isString(val) && (val.startsWith("https://github.com/") &&
|
|
137
|
+
val.includes("/releases/tag/") &&
|
|
138
|
+
stripper(val).split("/").length === 5);
|
|
139
|
+
};
|
|
@@ -49,8 +49,11 @@ export * from "./api-tg";
|
|
|
49
49
|
export * from "./isBooleanLike";
|
|
50
50
|
export * from "./isRegExp";
|
|
51
51
|
export * from "./isAlpha";
|
|
52
|
+
export * from "./github";
|
|
53
|
+
export * from "./retail";
|
|
52
54
|
export * from "./tokens/index";
|
|
53
55
|
export * from "./higher-order/index";
|
|
54
56
|
export * from "./tokens/index";
|
|
55
57
|
export * from "./html/index";
|
|
58
|
+
export * from "./countries/index";
|
|
56
59
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/type-guards/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAA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
|
|
51
51
|
export * from "./isAlpha";
|
|
52
|
+
export * from "./github";
|
|
53
|
+
export * from "./retail";
|
|
52
54
|
export * from "./tokens/index";
|
|
53
55
|
export * from "./higher-order/index";
|
|
54
56
|
export * from "./tokens/index";
|
|
55
57
|
export * from "./html/index";
|
|
58
|
+
export * from "./countries/index";
|
|
@@ -21,5 +21,5 @@ export declare const isUri: <T, P extends readonly NetworkProtocol[]>(val: T, ..
|
|
|
21
21
|
*
|
|
22
22
|
* **Related:** `isUri`
|
|
23
23
|
*/
|
|
24
|
-
export declare const isUrl: <T, P extends readonly NetworkProtocol[]>(val: T, ...protocols: P) => val is T & Uri<Keys<P>["length"] extends 0 ? "http" | "https" :
|
|
24
|
+
export declare const isUrl: <T, P extends readonly NetworkProtocol[]>(val: T, ...protocols: P) => val is T & Uri<Keys<P>["length"] extends 0 ? "http" | "https" : P[number]>;
|
|
25
25
|
//# sourceMappingURL=isUrl.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isUrl.d.ts","sourceRoot":"","sources":["../../../src/runtime/type-guards/isUrl.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAC,YAAY,EAAG,eAAe,EAAE,GAAG,EAAG,MAAM,iBAAiB,CAAC;AAE5E;;;;;;;;;;GAUG;AACH,eAAO,MAAM,KAAK,GAChB,CAAC,EACD,CAAC,SAAS,SAAS,eAAe,EAAE,OAC/B,CAAC,gBAAgB,CAAC,KAAG,GAAG,IAAI,CAAC,GAAG,GAAG,CACxC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GACzB,eAAe,GACf,YAAY,CAAC,CAAC,CAAC,CAOlB,CAAA;AAGD;;;;;;;;;GASG;AACH,eAAO,MAAM,KAAK,GAClB,CAAC,EACD,CAAC,SAAS,SAAS,eAAe,EAAE,OAC7B,CAAC,gBAAgB,CAAC,KAAG,GAAG,IAAI,CAAC,GAAG,GAAG,
|
|
1
|
+
{"version":3,"file":"isUrl.d.ts","sourceRoot":"","sources":["../../../src/runtime/type-guards/isUrl.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAC,YAAY,EAAG,eAAe,EAAE,GAAG,EAAG,MAAM,iBAAiB,CAAC;AAE5E;;;;;;;;;;GAUG;AACH,eAAO,MAAM,KAAK,GAChB,CAAC,EACD,CAAC,SAAS,SAAS,eAAe,EAAE,OAC/B,CAAC,gBAAgB,CAAC,KAAG,GAAG,IAAI,CAAC,GAAG,GAAG,CACxC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GACzB,eAAe,GACf,YAAY,CAAC,CAAC,CAAC,CAOlB,CAAA;AAGD;;;;;;;;;GASG;AACH,eAAO,MAAM,KAAK,GAClB,CAAC,EACD,CAAC,SAAS,SAAS,eAAe,EAAE,OAC7B,CAAC,gBAAgB,CAAC,KAAG,GAAG,IAAI,CAAC,GAAG,GAAG,CACxC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GACzB,MAAM,GAAG,OAAO,GAChB,CAAC,CAAC,MAAM,CAAC,CAOZ,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RepoSource, RepoUrls, SemanticVersion, UrlsFrom } from "src/types/index";
|
|
2
2
|
import { REPO_SOURCE_LOOKUP } from "src/constants/index";
|
|
3
3
|
/**
|
|
4
4
|
* **isRepoSource**`(val)`
|
|
@@ -25,19 +25,6 @@ export declare const isSemanticVersion: <T, P extends boolean>(v: T, allowPrefix
|
|
|
25
25
|
* Type guard which validates that the value passed in is a valid Repo URL
|
|
26
26
|
*/
|
|
27
27
|
export declare const isRepoUrl: <T>(val: T) => val is T & RepoUrls;
|
|
28
|
-
/**
|
|
29
|
-
* **isGithubUrl**`(val)`
|
|
30
|
-
*
|
|
31
|
-
* Type guard which validates that the value passed in is a valid Github URL
|
|
32
|
-
*/
|
|
33
|
-
export declare const isGithubUrl: <T>(val: T) => val is T & UrlsFrom<(typeof REPO_SOURCE_LOOKUP)["github"]>;
|
|
34
|
-
/**
|
|
35
|
-
* **isGithubRepoUrl**
|
|
36
|
-
*
|
|
37
|
-
* Type guard validating that passed in value is valid URL for
|
|
38
|
-
* a Github repo.
|
|
39
|
-
*/
|
|
40
|
-
export declare const isGithubRepoUrl: <T>(val: T) => val is T & `https://github.com/${string}/${AlphaNumericChar}${string}`;
|
|
41
28
|
/**
|
|
42
29
|
* **isBitbucketUrl**`(val)`
|
|
43
30
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repos.d.ts","sourceRoot":"","sources":["../../../src/runtime/type-guards/repos.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"repos.d.ts","sourceRoot":"","sources":["../../../src/runtime/type-guards/repos.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,QAAQ,EACR,eAAe,EACf,QAAQ,EACT,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAgB,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAGvE;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GAAI,CAAC,KAAK,CAAC,KAAG,CAAC,IAAI,CAAC,GAAG,UAE/C,CAAA;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,iBAAiB,GAAI,CAAC,EAAC,CAAC,SAAS,OAAO,KACjD,CAAC,gBACU,CAAC,KACb,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,CAAC,CAa5B,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,SAAS,GAAI,CAAC,OAAO,CAAC,KAAG,GAAG,IAAI,CAAC,GAAG,QAMhD,CAAA;AAGD;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAI,CAAC,OAAO,CAAC,KAAG,GAAG,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAA,OAAO,kBAAkB,EAAC,WAAW,CAAC,CAMpG,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAAI,CAAC,OAAO,CAAC,KAAG,GAAG,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAA,OAAO,kBAAkB,EAAC,YAAY,CAAC,CAMtG,CAAA"}
|
|
@@ -38,27 +38,6 @@ export const isRepoUrl = (val) => {
|
|
|
38
38
|
return isString(val) && baseUrls.every(u => val === u ||
|
|
39
39
|
val.startsWith(`${u}/`));
|
|
40
40
|
};
|
|
41
|
-
/**
|
|
42
|
-
* **isGithubUrl**`(val)`
|
|
43
|
-
*
|
|
44
|
-
* Type guard which validates that the value passed in is a valid Github URL
|
|
45
|
-
*/
|
|
46
|
-
export const isGithubUrl = (val) => {
|
|
47
|
-
const baseUrls = REPO_SOURCE_LOOKUP["github"];
|
|
48
|
-
return isString(val) && baseUrls.every(u => val === u ||
|
|
49
|
-
val.startsWith(`${u}/`));
|
|
50
|
-
};
|
|
51
|
-
/**
|
|
52
|
-
* **isGithubRepoUrl**
|
|
53
|
-
*
|
|
54
|
-
* Type guard validating that passed in value is valid URL for
|
|
55
|
-
* a Github repo.
|
|
56
|
-
*/
|
|
57
|
-
export const isGithubRepoUrl = (val) => {
|
|
58
|
-
const baseUrls = [""];
|
|
59
|
-
return isString(val) && baseUrls.every(u => val === u ||
|
|
60
|
-
val.startsWith(`${u}/`));
|
|
61
|
-
};
|
|
62
41
|
/**
|
|
63
42
|
* **isBitbucketUrl**`(val)`
|
|
64
43
|
*
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { AmazonUrl, AppleUrl, BestBuyUrl, CostCoUrl, CvsUrl, DellUrl, EbayUrl, EtsyUrl, HandMUrl, HomeDepotUrl, IkeaUrl, KrogerUrl, LowesUrl, MacysUrl, NikeUrl, TargetUrl, WalgreensUrl, WalmartUrl, WayFairUrl, WholeFoodsUrl, ZaraUrl } from "src/types/string-literals";
|
|
2
|
+
/**
|
|
3
|
+
* type guard which validates that the `val` passed in is a valid URL
|
|
4
|
+
* for **Whole Food Markets**.
|
|
5
|
+
*/
|
|
6
|
+
export declare const isWholeFoodsUrl: (val: unknown) => val is WholeFoodsUrl;
|
|
7
|
+
/**
|
|
8
|
+
* type guard which validates that the `val` passed in is a valid URL
|
|
9
|
+
* for **CVS** pharmacy.
|
|
10
|
+
*/
|
|
11
|
+
export declare const isCvsUrl: (val: unknown) => val is CvsUrl;
|
|
12
|
+
/**
|
|
13
|
+
* type guard which validates that the `val` passed in is a valid URL
|
|
14
|
+
* for **Walgreens** pharmacy.
|
|
15
|
+
*/
|
|
16
|
+
export declare const isWalgreensUrl: (val: unknown) => val is WalgreensUrl;
|
|
17
|
+
/**
|
|
18
|
+
* type guard which validates that the `val` passed in is a valid URL
|
|
19
|
+
* for **CVS** pharmacy.
|
|
20
|
+
*/
|
|
21
|
+
export declare const isKrogersUrl: (val: unknown) => val is KrogerUrl;
|
|
22
|
+
/**
|
|
23
|
+
* type guard which validates that the `val` passed in is a valid URL
|
|
24
|
+
* for **CVS** pharmacy.
|
|
25
|
+
*/
|
|
26
|
+
export declare const isZaraUrl: (val: unknown) => val is ZaraUrl;
|
|
27
|
+
/**
|
|
28
|
+
* type guard which validates that the `val` passed in is a valid URL
|
|
29
|
+
* for **H&M** retailer.
|
|
30
|
+
*/
|
|
31
|
+
export declare const isHmUrl: (val: unknown) => val is HandMUrl;
|
|
32
|
+
/**
|
|
33
|
+
* type guard which validates that the `val` passed in is a valid URL
|
|
34
|
+
* for **Dell** retailer.
|
|
35
|
+
*/
|
|
36
|
+
export declare const isDellUrl: (val: unknown) => val is DellUrl;
|
|
37
|
+
/**
|
|
38
|
+
* type guard which validates that the `val` passed in is a valid URL
|
|
39
|
+
* for **Ikea** retailer.
|
|
40
|
+
*/
|
|
41
|
+
export declare const isIkeaUrl: (val: unknown) => val is IkeaUrl;
|
|
42
|
+
/**
|
|
43
|
+
* type guard which validates that the `val` passed in is a valid URL
|
|
44
|
+
* for **Lowes** retailer.
|
|
45
|
+
*/
|
|
46
|
+
export declare const isLowesUrl: (val: unknown) => val is LowesUrl;
|
|
47
|
+
/**
|
|
48
|
+
* type guard which validates that the `val` passed in is a valid URL
|
|
49
|
+
* for **Macy's** retailer.
|
|
50
|
+
*/
|
|
51
|
+
export declare const isNikeUrl: (val: unknown) => val is NikeUrl;
|
|
52
|
+
/**
|
|
53
|
+
* type guard which validates that the `val` passed in is a valid URL
|
|
54
|
+
* for **Macy's** retailer.
|
|
55
|
+
*/
|
|
56
|
+
export declare const isWayfairUrl: (val: unknown) => val is WayFairUrl;
|
|
57
|
+
/**
|
|
58
|
+
* type guard which validates that the `val` passed in is a valid URL
|
|
59
|
+
* for **Macy's** retailer.
|
|
60
|
+
*/
|
|
61
|
+
export declare const isBestBuyUrl: (val: unknown) => val is BestBuyUrl;
|
|
62
|
+
/**
|
|
63
|
+
* type guard which validates that the `val` passed in is a valid URL
|
|
64
|
+
* for **Macy's** retailer.
|
|
65
|
+
*/
|
|
66
|
+
export declare const isCostCoUrl: (val: unknown) => val is CostCoUrl;
|
|
67
|
+
/**
|
|
68
|
+
* type guard which validates that the `val` passed in is a valid URL
|
|
69
|
+
* for **Macy's** retailer.
|
|
70
|
+
*/
|
|
71
|
+
export declare const isEtsyUrl: (val: unknown) => val is EtsyUrl;
|
|
72
|
+
/**
|
|
73
|
+
* type guard which validates that the `val` passed in is a valid URL
|
|
74
|
+
* for **Macy's** retailer.
|
|
75
|
+
*/
|
|
76
|
+
export declare const isTargetUrl: (val: unknown) => val is TargetUrl;
|
|
77
|
+
/**
|
|
78
|
+
* type guard which validates that the `val` passed in is a valid URL
|
|
79
|
+
* for **Macy's** retailer.
|
|
80
|
+
*/
|
|
81
|
+
export declare const isEbayUrl: (val: unknown) => val is EbayUrl;
|
|
82
|
+
/**
|
|
83
|
+
* type guard which validates that the `val` passed in is a valid URL
|
|
84
|
+
* for the **Home Depot** retailer.
|
|
85
|
+
*/
|
|
86
|
+
export declare const isHomeDepotUrl: (val: unknown) => val is HomeDepotUrl;
|
|
87
|
+
/**
|
|
88
|
+
* type guard which validates that the `val` passed in is a valid URL
|
|
89
|
+
* for the **Macy's** retailer.
|
|
90
|
+
*/
|
|
91
|
+
export declare const isMacysUrl: (val: unknown) => val is MacysUrl;
|
|
92
|
+
/**
|
|
93
|
+
* type guard which validates that the `val` passed in is a valid URL
|
|
94
|
+
* for **Apple**.
|
|
95
|
+
*/
|
|
96
|
+
export declare const isAppleUrl: (val: unknown) => val is AppleUrl;
|
|
97
|
+
/**
|
|
98
|
+
* type guard which validates that the `val` passed in is a valid URL
|
|
99
|
+
* for **Walmart**.
|
|
100
|
+
*/
|
|
101
|
+
export declare const isWalmartUrl: (val: unknown) => val is WalmartUrl;
|
|
102
|
+
/**
|
|
103
|
+
* type guard which validates that the `val` passed in is a valid URL
|
|
104
|
+
* for **Walmart**.
|
|
105
|
+
*/
|
|
106
|
+
export declare const isAmazonUrl: (val: unknown) => val is AmazonUrl;
|
|
107
|
+
//# sourceMappingURL=retail.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retail.d.ts","sourceRoot":"","sources":["../../../src/runtime/type-guards/retail.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAwB5Q;;;GAGG;AACH,eAAO,MAAM,eAAe,QAAS,OAAO,KAAG,GAAG,IAAI,aAErD,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,QAAQ,QAAS,OAAO,KAAG,GAAG,IAAI,MAE9C,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,cAAc,QAAS,OAAO,KAAG,GAAG,IAAI,YAE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U,QAAS,OAAO,KAAG,GAAG,IAAI,QAEhD,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,YAAY,QAAS,OAAO,KAAG,GAAG,IAAI,UAElD,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,QAAS,OAAO,KAAG,GAAG,IAAI,SAEjD,CAAA"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { isString } from "./isString";
|
|
2
|
+
import { AMAZON_DNS, APPLE_DNS, BEST_BUY_DNS, COSTCO_DNS, CVS_DNS, DELL_DNS, EBAY_DNS, ETSY_DNS, HM_DNS, HOME_DEPOT_DNS, KROGER_DNS, MACYS_DNS, NIKE_DNS, TARGET_DNS, WALGREENS_DNS, WALMART_DNS, WAYFAIR_DNS, WHOLE_FOODS_DNS, ZARA_DNS, } from "src/constants/index";
|
|
3
|
+
/**
|
|
4
|
+
* type guard which validates that the `val` passed in is a valid URL
|
|
5
|
+
* for **Whole Food Markets**.
|
|
6
|
+
*/
|
|
7
|
+
export const isWholeFoodsUrl = (val) => {
|
|
8
|
+
return isString(val) && WHOLE_FOODS_DNS.some(i => val.startsWith(`https://${i}`));
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* type guard which validates that the `val` passed in is a valid URL
|
|
12
|
+
* for **CVS** pharmacy.
|
|
13
|
+
*/
|
|
14
|
+
export const isCvsUrl = (val) => {
|
|
15
|
+
return isString(val) && CVS_DNS.some(i => val.startsWith(`https://${i}`));
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* type guard which validates that the `val` passed in is a valid URL
|
|
19
|
+
* for **Walgreens** pharmacy.
|
|
20
|
+
*/
|
|
21
|
+
export const isWalgreensUrl = (val) => {
|
|
22
|
+
return isString(val) && WALGREENS_DNS.some(i => val.startsWith(`https://${i}`));
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* type guard which validates that the `val` passed in is a valid URL
|
|
26
|
+
* for **CVS** pharmacy.
|
|
27
|
+
*/
|
|
28
|
+
export const isKrogersUrl = (val) => {
|
|
29
|
+
return isString(val) && KROGER_DNS.some(i => val.startsWith(`https://${i}`));
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* type guard which validates that the `val` passed in is a valid URL
|
|
33
|
+
* for **CVS** pharmacy.
|
|
34
|
+
*/
|
|
35
|
+
export const isZaraUrl = (val) => {
|
|
36
|
+
return isString(val) && ZARA_DNS.some(i => val.startsWith(`https://${i}`));
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* type guard which validates that the `val` passed in is a valid URL
|
|
40
|
+
* for **H&M** retailer.
|
|
41
|
+
*/
|
|
42
|
+
export const isHmUrl = (val) => {
|
|
43
|
+
return isString(val) && HM_DNS.some(i => val.startsWith(`https://${i}`));
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* type guard which validates that the `val` passed in is a valid URL
|
|
47
|
+
* for **Dell** retailer.
|
|
48
|
+
*/
|
|
49
|
+
export const isDellUrl = (val) => {
|
|
50
|
+
return isString(val) && DELL_DNS.some(i => val.startsWith(`https://${i}`));
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* type guard which validates that the `val` passed in is a valid URL
|
|
54
|
+
* for **Ikea** retailer.
|
|
55
|
+
*/
|
|
56
|
+
export const isIkeaUrl = (val) => {
|
|
57
|
+
return isString(val) && KROGER_DNS.some(i => val.startsWith(`https://${i}`));
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* type guard which validates that the `val` passed in is a valid URL
|
|
61
|
+
* for **Lowes** retailer.
|
|
62
|
+
*/
|
|
63
|
+
export const isLowesUrl = (val) => {
|
|
64
|
+
return isString(val) && KROGER_DNS.some(i => val.startsWith(`https://${i}`));
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* type guard which validates that the `val` passed in is a valid URL
|
|
68
|
+
* for **Macy's** retailer.
|
|
69
|
+
*/
|
|
70
|
+
export const isNikeUrl = (val) => {
|
|
71
|
+
return isString(val) && NIKE_DNS.some(i => val.startsWith(`https://${i}`));
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* type guard which validates that the `val` passed in is a valid URL
|
|
75
|
+
* for **Macy's** retailer.
|
|
76
|
+
*/
|
|
77
|
+
export const isWayfairUrl = (val) => {
|
|
78
|
+
return isString(val) && WAYFAIR_DNS.some(i => val.startsWith(`https://${i}`));
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* type guard which validates that the `val` passed in is a valid URL
|
|
82
|
+
* for **Macy's** retailer.
|
|
83
|
+
*/
|
|
84
|
+
export const isBestBuyUrl = (val) => {
|
|
85
|
+
return isString(val) && BEST_BUY_DNS.some(i => val.startsWith(`https://${i}`));
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* type guard which validates that the `val` passed in is a valid URL
|
|
89
|
+
* for **Macy's** retailer.
|
|
90
|
+
*/
|
|
91
|
+
export const isCostCoUrl = (val) => {
|
|
92
|
+
return isString(val) && COSTCO_DNS.some(i => val.startsWith(`https://${i}`));
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* type guard which validates that the `val` passed in is a valid URL
|
|
96
|
+
* for **Macy's** retailer.
|
|
97
|
+
*/
|
|
98
|
+
export const isEtsyUrl = (val) => {
|
|
99
|
+
return isString(val) && ETSY_DNS.some(i => val.startsWith(`https://${i}`));
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* type guard which validates that the `val` passed in is a valid URL
|
|
103
|
+
* for **Macy's** retailer.
|
|
104
|
+
*/
|
|
105
|
+
export const isTargetUrl = (val) => {
|
|
106
|
+
return isString(val) && TARGET_DNS.some(i => val.startsWith(`https://${i}`));
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* type guard which validates that the `val` passed in is a valid URL
|
|
110
|
+
* for **Macy's** retailer.
|
|
111
|
+
*/
|
|
112
|
+
export const isEbayUrl = (val) => {
|
|
113
|
+
return isString(val) && EBAY_DNS.some(i => val.startsWith(`https://${i}`));
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* type guard which validates that the `val` passed in is a valid URL
|
|
117
|
+
* for the **Home Depot** retailer.
|
|
118
|
+
*/
|
|
119
|
+
export const isHomeDepotUrl = (val) => {
|
|
120
|
+
return isString(val) && HOME_DEPOT_DNS.some(i => val.startsWith(`https://${i}`));
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* type guard which validates that the `val` passed in is a valid URL
|
|
124
|
+
* for the **Macy's** retailer.
|
|
125
|
+
*/
|
|
126
|
+
export const isMacysUrl = (val) => {
|
|
127
|
+
return isString(val) && MACYS_DNS.some(i => val.startsWith(`https://${i}`));
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* type guard which validates that the `val` passed in is a valid URL
|
|
131
|
+
* for **Apple**.
|
|
132
|
+
*/
|
|
133
|
+
export const isAppleUrl = (val) => {
|
|
134
|
+
return isString(val) && APPLE_DNS.some(i => val.startsWith(`https://${i}`));
|
|
135
|
+
};
|
|
136
|
+
/**
|
|
137
|
+
* type guard which validates that the `val` passed in is a valid URL
|
|
138
|
+
* for **Walmart**.
|
|
139
|
+
*/
|
|
140
|
+
export const isWalmartUrl = (val) => {
|
|
141
|
+
return isString(val) && WALMART_DNS.some(i => val.startsWith(`https://${i}`));
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* type guard which validates that the `val` passed in is a valid URL
|
|
145
|
+
* for **Walmart**.
|
|
146
|
+
*/
|
|
147
|
+
export const isAmazonUrl = (val) => {
|
|
148
|
+
return isString(val) && AMAZON_DNS.some(i => val.startsWith(`https://${i}`));
|
|
149
|
+
};
|