inferred-types 0.50.19 → 0.50.21
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/index.cjs +2 -2
- package/dist/index.js +2 -2
- package/dist/inferred-types/tsconfig.tsbuildinfo +1 -1
- package/dist/runtime/tsconfig.tsbuildinfo +1 -1
- package/dist/runtime/type-guards/isEmail.d.ts +1 -0
- package/dist/runtime/type-guards/isEmail.d.ts.map +1 -1
- package/dist/runtime/type-guards/isEmail.js +2 -1
- package/dist/runtime/type-guards/repos.d.ts +1 -1
- package/dist/runtime/type-guards/repos.d.ts.map +1 -1
- package/dist/runtime/type-guards/repos.js +1 -1
- package/package.json +1 -1
|
@@ -8,6 +8,7 @@ import { Email } from "src/types/index";
|
|
|
8
8
|
* 1. that leads with alphabetic char
|
|
9
9
|
* 2. has a `@` character
|
|
10
10
|
* 3. has at least one `.` char after the `@`
|
|
11
|
+
* 4. top-level domain has at least 2 characters
|
|
11
12
|
*/
|
|
12
13
|
export declare const isEmail: (val: unknown) => val is Email;
|
|
13
14
|
//# sourceMappingURL=isEmail.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isEmail.d.ts","sourceRoot":"","sources":["../../../src/runtime/type-guards/isEmail.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAIvC
|
|
1
|
+
{"version":3,"file":"isEmail.d.ts","sourceRoot":"","sources":["../../../src/runtime/type-guards/isEmail.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAIvC;;;;;;;;;;GAUG;AACH,eAAO,MAAM,OAAO,QAAS,OAAO,KAAG,GAAG,IAAI,KAe7C,CAAA"}
|
|
@@ -9,6 +9,7 @@ import { LOWER_ALPHA_CHARS } from "src/constants/Alpha";
|
|
|
9
9
|
* 1. that leads with alphabetic char
|
|
10
10
|
* 2. has a `@` character
|
|
11
11
|
* 3. has at least one `.` char after the `@`
|
|
12
|
+
* 4. top-level domain has at least 2 characters
|
|
12
13
|
*/
|
|
13
14
|
export const isEmail = (val) => {
|
|
14
15
|
if (!isString(val)) {
|
|
@@ -16,7 +17,7 @@ export const isEmail = (val) => {
|
|
|
16
17
|
}
|
|
17
18
|
const parts = val?.split("@");
|
|
18
19
|
const domain = parts[1]?.split(".");
|
|
19
|
-
const tld = domain.pop();
|
|
20
|
+
const tld = domain ? domain.pop() : "";
|
|
20
21
|
const firstChar = val[0].toLowerCase();
|
|
21
22
|
return isString(val) && (LOWER_ALPHA_CHARS.includes(firstChar) &&
|
|
22
23
|
parts.length === 2 &&
|
|
@@ -24,7 +24,7 @@ export declare const isSemanticVersion: <T, P extends boolean>(v: T, allowPrefix
|
|
|
24
24
|
*
|
|
25
25
|
* Type guard which validates that the value passed in is a valid Repo URL
|
|
26
26
|
*/
|
|
27
|
-
export declare const isRepoUrl:
|
|
27
|
+
export declare const isRepoUrl: (val: unknown) => val is RepoUrls;
|
|
28
28
|
/**
|
|
29
29
|
* **isBitbucketUrl**`(val)`
|
|
30
30
|
*
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,QAAS,OAAO,KAAG,GAAG,IAAI,QAM/C,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"}
|
|
@@ -35,7 +35,7 @@ export const isSemanticVersion = (v, allowPrefix = false) => {
|
|
|
35
35
|
*/
|
|
36
36
|
export const isRepoUrl = (val) => {
|
|
37
37
|
const baseUrls = valuesOf(REPO_SOURCE_LOOKUP).flat();
|
|
38
|
-
return isString(val) && baseUrls.
|
|
38
|
+
return isString(val) && baseUrls.some(u => val === u ||
|
|
39
39
|
val.startsWith(`${u}/`));
|
|
40
40
|
};
|
|
41
41
|
/**
|