inferred-types 0.43.6 → 0.45.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 (177) hide show
  1. package/dist/constants/NetworkConstants.d.ts +29 -0
  2. package/dist/constants/NetworkConstants.d.ts.map +1 -0
  3. package/dist/constants/NetworkConstants.js +83 -0
  4. package/dist/constants/RepoConstants.d.ts +31 -0
  5. package/dist/constants/RepoConstants.d.ts.map +1 -0
  6. package/dist/constants/RepoConstants.js +48 -0
  7. package/dist/constants/index.d.ts +2 -1
  8. package/dist/constants/index.d.ts.map +1 -1
  9. package/dist/constants/index.js +2 -1
  10. package/dist/constants/tsconfig.tsbuildinfo +1 -1
  11. package/dist/inferred-types/index.cjs +646 -312
  12. package/dist/inferred-types/tsconfig.tsbuildinfo +1 -1
  13. package/dist/runtime/dictionary/valuesOf.d.ts +1 -1
  14. package/dist/runtime/dictionary/valuesOf.d.ts.map +1 -1
  15. package/dist/runtime/dictionary/withKeys.d.ts +1 -1
  16. package/dist/runtime/index.d.ts +1 -0
  17. package/dist/runtime/index.d.ts.map +1 -1
  18. package/dist/runtime/index.js +1 -0
  19. package/dist/runtime/literals/index.d.ts +1 -0
  20. package/dist/runtime/literals/index.d.ts.map +1 -1
  21. package/dist/runtime/literals/index.js +1 -0
  22. package/dist/runtime/literals/takeNumericCharacters.d.ts +9 -0
  23. package/dist/runtime/literals/takeNumericCharacters.d.ts.map +1 -0
  24. package/dist/runtime/literals/takeNumericCharacters.js +12 -0
  25. package/dist/runtime/meta/index.d.ts +3 -0
  26. package/dist/runtime/meta/index.d.ts.map +1 -0
  27. package/dist/runtime/meta/index.js +2 -0
  28. package/dist/runtime/meta/urlMeta.d.ts +52 -0
  29. package/dist/runtime/meta/urlMeta.d.ts.map +1 -0
  30. package/dist/runtime/meta/urlMeta.js +57 -0
  31. package/dist/runtime/meta/youtube-meta.d.ts +31 -0
  32. package/dist/runtime/meta/youtube-meta.d.ts.map +1 -0
  33. package/dist/runtime/meta/youtube-meta.js +19 -0
  34. package/dist/runtime/runtime-types/parse.d.ts +1 -1
  35. package/dist/runtime/runtime-types/shape-helpers/getTokenData.d.ts +1 -1
  36. package/dist/runtime/runtime-types/shape-helpers/getTokenName.d.ts +1 -1
  37. package/dist/runtime/runtime-types/shape-helpers/singletons.d.ts.map +1 -1
  38. package/dist/runtime/runtime-types/shape-helpers/singletons.js +1 -1
  39. package/dist/runtime/runtime-types/shape.d.ts +1 -1
  40. package/dist/runtime/tsconfig.tsbuildinfo +1 -1
  41. package/dist/runtime/type-conversion/asChars.d.ts +8 -0
  42. package/dist/runtime/type-conversion/asChars.d.ts.map +1 -0
  43. package/dist/runtime/type-conversion/asChars.js +8 -0
  44. package/dist/runtime/type-conversion/index.d.ts +2 -0
  45. package/dist/runtime/type-conversion/index.d.ts.map +1 -1
  46. package/dist/runtime/type-conversion/index.js +2 -0
  47. package/dist/runtime/type-conversion/ip6GroupExpansion.d.ts +14 -0
  48. package/dist/runtime/type-conversion/ip6GroupExpansion.d.ts.map +1 -0
  49. package/dist/runtime/type-conversion/ip6GroupExpansion.js +15 -0
  50. package/dist/runtime/type-guards/index.d.ts +4 -0
  51. package/dist/runtime/type-guards/index.d.ts.map +1 -1
  52. package/dist/runtime/type-guards/index.js +4 -0
  53. package/dist/runtime/type-guards/isHexadecimal.d.ts +8 -0
  54. package/dist/runtime/type-guards/isHexadecimal.d.ts.map +1 -0
  55. package/dist/runtime/type-guards/isHexadecimal.js +13 -0
  56. package/dist/runtime/type-guards/isUrl.d.ts +20 -4
  57. package/dist/runtime/type-guards/isUrl.d.ts.map +1 -1
  58. package/dist/runtime/type-guards/isUrl.js +29 -9
  59. package/dist/runtime/type-guards/network-tg.d.ts +48 -0
  60. package/dist/runtime/type-guards/network-tg.d.ts.map +1 -0
  61. package/dist/runtime/type-guards/network-tg.js +85 -0
  62. package/dist/runtime/type-guards/repos.d.ts +45 -0
  63. package/dist/runtime/type-guards/repos.d.ts.map +1 -0
  64. package/dist/runtime/type-guards/repos.js +77 -0
  65. package/dist/runtime/type-guards/youtube.d.ts +42 -0
  66. package/dist/runtime/type-guards/youtube.d.ts.map +1 -0
  67. package/dist/runtime/type-guards/youtube.js +74 -0
  68. package/dist/types/{numeric-literals/ValueCallback.d.ts → api/api.d.ts} +1 -1
  69. package/dist/types/api/api.d.ts.map +1 -0
  70. package/dist/types/api/index.d.ts +2 -0
  71. package/dist/types/api/index.d.ts.map +1 -0
  72. package/dist/types/api/index.js +1 -0
  73. package/dist/types/boolean-logic/branching/OnPass.d.ts +29 -0
  74. package/dist/types/boolean-logic/branching/OnPass.d.ts.map +1 -0
  75. package/dist/types/boolean-logic/branching/index.d.ts +1 -0
  76. package/dist/types/boolean-logic/branching/index.d.ts.map +1 -1
  77. package/dist/types/boolean-logic/branching/index.js +1 -0
  78. package/dist/types/boolean-logic/combinators/And.d.ts +1 -1
  79. package/dist/types/boolean-logic/combinators/And.d.ts.map +1 -1
  80. package/dist/types/boolean-logic/combinators/Not.d.ts +5 -6
  81. package/dist/types/boolean-logic/combinators/Not.d.ts.map +1 -1
  82. package/dist/types/boolean-logic/operators/Extends.d.ts +2 -1
  83. package/dist/types/boolean-logic/operators/Extends.d.ts.map +1 -1
  84. package/dist/types/boolean-logic/operators/IsBoolean.d.ts +2 -1
  85. package/dist/types/boolean-logic/operators/IsBoolean.d.ts.map +1 -1
  86. package/dist/types/boolean-logic/operators/IsCssHexadecimal.d.ts +9 -0
  87. package/dist/types/boolean-logic/operators/IsCssHexadecimal.d.ts.map +1 -0
  88. package/dist/types/boolean-logic/operators/IsCssHexadecimal.js +1 -0
  89. package/dist/types/boolean-logic/operators/IsEqual.d.ts +7 -1
  90. package/dist/types/boolean-logic/operators/IsEqual.d.ts.map +1 -1
  91. package/dist/types/boolean-logic/operators/IsLessThan.d.ts +13 -0
  92. package/dist/types/boolean-logic/operators/IsLessThan.d.ts.map +1 -0
  93. package/dist/types/boolean-logic/operators/IsLessThan.js +1 -0
  94. package/dist/types/boolean-logic/operators/IsNever.d.ts +2 -1
  95. package/dist/types/boolean-logic/operators/IsNever.d.ts.map +1 -1
  96. package/dist/types/boolean-logic/operators/IsNumber.d.ts +2 -2
  97. package/dist/types/boolean-logic/operators/IsNumber.d.ts.map +1 -1
  98. package/dist/types/boolean-logic/operators/IsString.d.ts +2 -2
  99. package/dist/types/boolean-logic/operators/IsString.d.ts.map +1 -1
  100. package/dist/types/boolean-logic/operators/IsUrl.d.ts +35 -0
  101. package/dist/types/boolean-logic/operators/IsUrl.d.ts.map +1 -0
  102. package/dist/types/boolean-logic/operators/IsUrl.js +1 -0
  103. package/dist/types/boolean-logic/operators/Network-operators.d.ts +71 -0
  104. package/dist/types/boolean-logic/operators/Network-operators.d.ts.map +1 -0
  105. package/dist/types/boolean-logic/operators/Network-operators.js +1 -0
  106. package/dist/types/boolean-logic/operators/YouTube-operators.d.ts +32 -0
  107. package/dist/types/boolean-logic/operators/YouTube-operators.d.ts.map +1 -0
  108. package/dist/types/boolean-logic/operators/YouTube-operators.js +1 -0
  109. package/dist/types/boolean-logic/operators/index.d.ts +4 -1
  110. package/dist/types/boolean-logic/operators/index.d.ts.map +1 -1
  111. package/dist/types/boolean-logic/operators/index.js +4 -1
  112. package/dist/types/index.d.ts +1 -0
  113. package/dist/types/index.d.ts.map +1 -1
  114. package/dist/types/index.js +1 -0
  115. package/dist/types/literals/ExpandRecursively.d.ts +7 -1
  116. package/dist/types/literals/ExpandRecursively.d.ts.map +1 -1
  117. package/dist/types/literals/Shape.d.ts +1 -1
  118. package/dist/types/literals/Shape.d.ts.map +1 -1
  119. package/dist/types/numeric-literals/index.d.ts +0 -1
  120. package/dist/types/numeric-literals/index.d.ts.map +1 -1
  121. package/dist/types/numeric-literals/index.js +0 -1
  122. package/dist/types/string-literals/RetainUntil.d.ts +33 -0
  123. package/dist/types/string-literals/RetainUntil.d.ts.map +1 -0
  124. package/dist/types/string-literals/RetainUntil.js +1 -0
  125. package/dist/types/string-literals/Split.d.ts +3 -3
  126. package/dist/types/string-literals/Split.d.ts.map +1 -1
  127. package/dist/types/string-literals/StripAfter.d.ts +2 -2
  128. package/dist/types/string-literals/StripAfter.d.ts.map +1 -1
  129. package/dist/types/string-literals/StripBefore.d.ts +2 -2
  130. package/dist/types/string-literals/StripBefore.d.ts.map +1 -1
  131. package/dist/types/string-literals/StripUntil.d.ts +6 -0
  132. package/dist/types/string-literals/StripUntil.d.ts.map +1 -0
  133. package/dist/types/string-literals/StripUntil.js +1 -0
  134. package/dist/types/string-literals/character-sets/DomainName.d.ts +26 -18
  135. package/dist/types/string-literals/character-sets/DomainName.d.ts.map +1 -1
  136. package/dist/types/string-literals/character-sets/InlineSvg.d.ts +2 -2
  137. package/dist/types/string-literals/character-sets/InlineSvg.d.ts.map +1 -1
  138. package/dist/types/string-literals/character-sets/IpAddress.d.ts +28 -4
  139. package/dist/types/string-literals/character-sets/IpAddress.d.ts.map +1 -1
  140. package/dist/types/string-literals/character-sets/Optional.d.ts +14 -0
  141. package/dist/types/string-literals/character-sets/Optional.d.ts.map +1 -0
  142. package/dist/types/string-literals/character-sets/Optional.js +1 -0
  143. package/dist/types/string-literals/character-sets/Repos.d.ts +108 -0
  144. package/dist/types/string-literals/character-sets/Repos.d.ts.map +1 -0
  145. package/dist/types/string-literals/character-sets/Repos.js +1 -0
  146. package/dist/types/string-literals/character-sets/Url.d.ts +208 -6
  147. package/dist/types/string-literals/character-sets/Url.d.ts.map +1 -1
  148. package/dist/types/string-literals/character-sets/Url.js +1 -0
  149. package/dist/types/string-literals/character-sets/YouTube.d.ts +127 -0
  150. package/dist/types/string-literals/character-sets/YouTube.d.ts.map +1 -0
  151. package/dist/types/string-literals/character-sets/YouTube.js +1 -0
  152. package/dist/types/string-literals/character-sets/index.d.ts +4 -0
  153. package/dist/types/string-literals/character-sets/index.d.ts.map +1 -1
  154. package/dist/types/string-literals/character-sets/index.js +4 -0
  155. package/dist/types/string-literals/index.d.ts +2 -0
  156. package/dist/types/string-literals/index.d.ts.map +1 -1
  157. package/dist/types/string-literals/index.js +2 -0
  158. package/dist/types/tsconfig.tsbuildinfo +1 -1
  159. package/dist/types/type-conversion/MergeObjects.d.ts.map +1 -1
  160. package/dist/types/type-conversion/RetainChars.d.ts +15 -0
  161. package/dist/types/type-conversion/RetainChars.d.ts.map +1 -0
  162. package/dist/types/type-conversion/RetainChars.js +1 -0
  163. package/dist/types/type-conversion/StripChars.d.ts +18 -0
  164. package/dist/types/type-conversion/StripChars.d.ts.map +1 -0
  165. package/dist/types/type-conversion/StripChars.js +1 -0
  166. package/dist/types/type-conversion/index.d.ts +2 -0
  167. package/dist/types/type-conversion/index.d.ts.map +1 -1
  168. package/dist/types/type-conversion/index.js +2 -0
  169. package/package.json +9 -9
  170. package/dist/constants/TCP_IP.d.ts +0 -11
  171. package/dist/constants/TCP_IP.d.ts.map +0 -1
  172. package/dist/constants/TCP_IP.js +0 -10
  173. package/dist/types/boolean-logic/operators/IsHexadecimal.d.ts +0 -9
  174. package/dist/types/boolean-logic/operators/IsHexadecimal.d.ts.map +0 -1
  175. package/dist/types/numeric-literals/ValueCallback.d.ts.map +0 -1
  176. /package/dist/types/{boolean-logic/operators/IsHexadecimal.js → api/api.js} +0 -0
  177. /package/dist/types/{numeric-literals/ValueCallback.js → boolean-logic/branching/OnPass.js} +0 -0
@@ -0,0 +1,8 @@
1
+ import { Chars } from "../../types/index";
2
+ /**
3
+ * **asChars**`(str)`
4
+ *
5
+ * Converts a string into an array of characters.
6
+ */
7
+ export declare const asChars: <T extends string>(str: T) => Chars<T>;
8
+ //# sourceMappingURL=asChars.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asChars.d.ts","sourceRoot":"","sources":["../../../src/runtime/type-conversion/asChars.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,0BAAwB;AAExC;;;;GAIG;AACH,eAAO,MAAM,OAAO,0BAA2B,CAAC,KAAG,MAAM,CAAC,CAEzD,CAAA"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * **asChars**`(str)`
3
+ *
4
+ * Converts a string into an array of characters.
5
+ */
6
+ export const asChars = (str) => {
7
+ return str.split("");
8
+ };
@@ -9,4 +9,6 @@ export * from "./union";
9
9
  export * from "./toNumber";
10
10
  export * from "./asRecord";
11
11
  export * from "./asString";
12
+ export * from "./asChars";
13
+ export * from "./ip6GroupExpansion";
12
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/type-conversion/index.ts"],"names":[],"mappings":"AACA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/type-conversion/index.ts"],"names":[],"mappings":"AACA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,qBAAqB,CAAC"}
@@ -9,3 +9,5 @@ export * from "./union.js";
9
9
  export * from "./toNumber.js";
10
10
  export * from "./asRecord.js";
11
11
  export * from "./asString.js";
12
+ export * from "./asChars.js";
13
+ export * from "./ip6GroupExpansion.js";
@@ -0,0 +1,14 @@
1
+ import { Ip6GroupExpansion } from "../../types/index";
2
+ /**
3
+ * **ip6GroupExpansion**`(ip)`
4
+ *
5
+ * Looks at the IPv6 address and expands all instances of `::` to add
6
+ * a block of `0000` where it was.
7
+ *
8
+ * ```ts
9
+ * // fe89:0000:1256
10
+ * const ip6 = ip6GroupExpansion("fe89::1256");
11
+ * ```
12
+ */
13
+ export declare const ip6GroupExpansion: <T extends string>(ip: T) => Ip6GroupExpansion<T>;
14
+ //# sourceMappingURL=ip6GroupExpansion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ip6GroupExpansion.d.ts","sourceRoot":"","sources":["../../../src/runtime/type-conversion/ip6GroupExpansion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,0BAAuB;AAGnD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,iBAAiB,yBAA0B,CAAC,yBAExD,CAAA"}
@@ -0,0 +1,15 @@
1
+ import { stripTrailing } from "../literals/stripTrailing.js";
2
+ /**
3
+ * **ip6GroupExpansion**`(ip)`
4
+ *
5
+ * Looks at the IPv6 address and expands all instances of `::` to add
6
+ * a block of `0000` where it was.
7
+ *
8
+ * ```ts
9
+ * // fe89:0000:1256
10
+ * const ip6 = ip6GroupExpansion("fe89::1256");
11
+ * ```
12
+ */
13
+ export const ip6GroupExpansion = (ip) => {
14
+ return stripTrailing(ip.replaceAll("::", ":0000:"), ":");
15
+ };
@@ -35,5 +35,9 @@ export * from "./isDoneFn";
35
35
  export * from "./isUrl";
36
36
  export * from "./isCssAspectRatio";
37
37
  export * from "./isInlineSvg";
38
+ export * from "./youtube";
39
+ export * from "./repos";
40
+ export * from "./network-tg";
41
+ export * from "./isHexadecimal";
38
42
  export * from "./higher-order/index";
39
43
  //# 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,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;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,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAGhC,cAAc,sBAAsB,CAAC"}
@@ -35,4 +35,8 @@ export * from "./isDoneFn.js";
35
35
  export * from "./isUrl.js";
36
36
  export * from "./isCssAspectRatio.js";
37
37
  export * from "./isInlineSvg.js";
38
+ export * from "./youtube.js";
39
+ export * from "./repos.js";
40
+ export * from "./network-tg.js";
41
+ export * from "./isHexadecimal.js";
38
42
  export * from "./higher-order/index.js";
@@ -0,0 +1,8 @@
1
+ /**
2
+ * **isHexadecimal**`(val)`
3
+ *
4
+ * Type guard which checks whether all of the characters in the given string
5
+ * are hexadecimal characters.
6
+ */
7
+ export declare const isHexadecimal: <T>(val: T) => val is T;
8
+ //# sourceMappingURL=isHexadecimal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isHexadecimal.d.ts","sourceRoot":"","sources":["../../../src/runtime/type-guards/isHexadecimal.ts"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,eAAO,MAAM,aAAa,WAAY,CAAC,aAGtC,CAAA"}
@@ -0,0 +1,13 @@
1
+ import { asChars } from "../type-conversion/asChars.js";
2
+ import { isNumericString } from "./isNumericString.js";
3
+ import { isString } from "./isString.js";
4
+ /**
5
+ * **isHexadecimal**`(val)`
6
+ *
7
+ * Type guard which checks whether all of the characters in the given string
8
+ * are hexadecimal characters.
9
+ */
10
+ export const isHexadecimal = (val) => {
11
+ return isString(val) &&
12
+ asChars(val).every(i => isNumericString(i) || ["a", "b", "c", "d", "e", "f"].includes(i.toLowerCase()));
13
+ };
@@ -1,9 +1,25 @@
1
+ import { Keys, TupleToUnion, NetworkProtocol } from "../../types/index";
1
2
  /**
2
- * Type guard to test with the passed in value is a http/https URL.
3
+ * **isUri**`(val, ...protocols)`
4
+ *
5
+ * Type guard to test with the passed in value is a valid URI.
6
+ *
7
+ * **Note:** by default all protocols in `NetworkProtocol` are
8
+ * considered valid but you can scope this down by setting which
9
+ * protocols you explicitly interested in.
10
+ *
11
+ * **Related:** `isUrl`
3
12
  */
4
- export declare const isUrl: <T>(val: T) => val is T & (`http://${string}` | `https://${string}`);
13
+ export declare const isUri: <T, P extends readonly NetworkProtocol[]>(val: T, ...protocols: P) => val is T & `${Keys<P>["length"] extends 0 ? NetworkProtocol : TupleToUnion<P>}://${string}`;
5
14
  /**
6
- * Type guard to test with the passed in value is a valid URI.
15
+ * **isUrl**`(val,[...protocols])`
16
+ *
17
+ * Type guard to test with the passed in value is a http/https URL.
18
+ *
19
+ * **Note:** you _can_ specify precisely which network protocols you
20
+ * are wanting to test for but by default it is "http" and "https"
21
+ *
22
+ * **Related:** `isUri`
7
23
  */
8
- export declare const isUri: <T>(val: T) => val is T & (`http://${string}` | `https://${string}` | `file://${string}` | `ws://${string}` | `wss://${string}`);
24
+ export declare const isUrl: <T, P extends readonly NetworkProtocol[]>(val: T, ...protocols: P) => val is T & `${Keys<P>["length"] extends 0 ? "http" | "https" : TupleToUnion<P>}://${string}`;
9
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":"AAGA;;GAEG;AACH,eAAO,MAAM,KAAK,WAAY,CAAC,0DAE9B,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,KAAK,WAAY,CAAC,sHAM9B,CAAA"}
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,EAAQ,0BAAwB;AAE5E;;;;;;;;;;GAUG;AACH,eAAO,MAAM,KAAK,iDAGX,CAAC,gBAAgB,CAAC,gGAUxB,CAAA;AAGD;;;;;;;;;GASG;AACH,eAAO,MAAM,KAAK,iDAGX,CAAC,gBAAgB,CAAC,iGAUxB,CAAA"}
@@ -1,15 +1,35 @@
1
- import { isString } from "./isString.js";
1
+ import { isString, valuesOf } from "../index.js";
2
+ import { NETWORK_PROTOCOL_LOOKUP } from "../../constants/index.js";
2
3
  /**
3
- * Type guard to test with the passed in value is a http/https URL.
4
+ * **isUri**`(val, ...protocols)`
5
+ *
6
+ * Type guard to test with the passed in value is a valid URI.
7
+ *
8
+ * **Note:** by default all protocols in `NetworkProtocol` are
9
+ * considered valid but you can scope this down by setting which
10
+ * protocols you explicitly interested in.
11
+ *
12
+ * **Related:** `isUrl`
4
13
  */
5
- export const isUrl = (val) => {
6
- return isString(val) && (val.startsWith("http://") || val.startsWith("https://"));
14
+ export const isUri = (val, ...protocols) => {
15
+ const p = protocols.length === 0
16
+ ? valuesOf(NETWORK_PROTOCOL_LOOKUP).flat().filter(i => i)
17
+ : protocols;
18
+ return isString(val) && p.some(i => val.startsWith(`${i}://`));
7
19
  };
8
20
  /**
9
- * Type guard to test with the passed in value is a valid URI.
21
+ * **isUrl**`(val,[...protocols])`
22
+ *
23
+ * Type guard to test with the passed in value is a http/https URL.
24
+ *
25
+ * **Note:** you _can_ specify precisely which network protocols you
26
+ * are wanting to test for but by default it is "http" and "https"
27
+ *
28
+ * **Related:** `isUri`
10
29
  */
11
- export const isUri = (val) => {
12
- return isString(val) && (val.startsWith("http://") || val.startsWith("https://") ||
13
- val.startsWith("file://") || val.startsWith("wss://") ||
14
- val.startsWith("ws://"));
30
+ export const isUrl = (val, ...protocols) => {
31
+ const p = protocols.length === 0
32
+ ? ["http", "https"]
33
+ : protocols;
34
+ return isString(val) && p.some(i => val.startsWith(`${i}://`));
15
35
  };
@@ -0,0 +1,48 @@
1
+ import { DomainName, GetUrlProtocolPrefix, GetUrlSource } from "../../types/index";
2
+ import { AsString } from "../../types/type-conversion/AsString";
3
+ /**
4
+ * **isIp4Address**`(val)`
5
+ *
6
+ * Type guard which checks whether the value is a valid IPv4 address.
7
+ */
8
+ export declare const isIp4Address: <T>(val: T) => val is T & `${number}.${number}.${number}.${number}`;
9
+ /**
10
+ * **isIp6Address**`(val)`
11
+ *
12
+ * Type guard which checks whether the value is a valid IPv6 address.
13
+ */
14
+ export declare const isIp6Address: <T>(val: T) => val is T & (`0${string}:${string}` | `1${string}:${string}` | `2${string}:${string}` | `3${string}:${string}` | `4${string}:${string}` | `5${string}:${string}` | `6${string}:${string}` | `7${string}:${string}` | `8${string}:${string}` | `9${string}:${string}` | `E${string}:${string}` | `A${string}:${string}` | `B${string}:${string}` | `C${string}:${string}` | `D${string}:${string}` | `F${string}:${string}` | `a${string}:${string}` | `b${string}:${string}` | `c${string}:${string}` | `d${string}:${string}` | `e${string}:${string}` | `f${string}:${string}`);
15
+ /**
16
+ * **isIpAddress**`(val)`
17
+ *
18
+ * Type guard which checks whether the value is a valid IP address (v4 or v6).
19
+ */
20
+ export declare const isIpAddress: <T>(val: T) => val is T & (`${number}.${number}.${number}.${number}` | `0${string}:${string}` | `1${string}:${string}` | `2${string}:${string}` | `3${string}:${string}` | `4${string}:${string}` | `5${string}:${string}` | `6${string}:${string}` | `7${string}:${string}` | `8${string}:${string}` | `9${string}:${string}` | `E${string}:${string}` | `A${string}:${string}` | `B${string}:${string}` | `C${string}:${string}` | `D${string}:${string}` | `F${string}:${string}` | `a${string}:${string}` | `b${string}:${string}` | `c${string}:${string}` | `d${string}:${string}` | `e${string}:${string}` | `f${string}:${string}`);
21
+ /**
22
+ * **hasUrlPort**`(val)`
23
+ *
24
+ * Type guard which tests whether there is an explicit _port_ reference
25
+ * in the passed in URL (versus implicitly using the default port of the
26
+ * protocol)
27
+ */
28
+ export declare const hasUrlPort: <T>(val: T) => val is T & `${GetUrlProtocolPrefix<T>}${GetUrlSource<AsString<T>>}:${number}${string}`;
29
+ /**
30
+ * **isUrlPath**`(val)`
31
+ *
32
+ * Type guard which checks whether the value is a valid `UrlPath`
33
+ */
34
+ export declare const isUrlPath: <T>(val: T) => val is T & ("" | `/-${string}` | `/0${string}` | `/1${string}` | `/2${string}` | `/3${string}` | `/4${string}` | `/5${string}` | `/6${string}` | `/7${string}` | `/8${string}` | `/9${string}` | `/x${string}` | `/E${string}` | `/A${string}` | `/B${string}` | `/C${string}` | `/D${string}` | `/F${string}` | `/G${string}` | `/H${string}` | `/I${string}` | `/J${string}` | `/K${string}` | `/L${string}` | `/M${string}` | `/N${string}` | `/O${string}` | `/P${string}` | `/Q${string}` | `/R${string}` | `/S${string}` | `/T${string}` | `/U${string}` | `/V${string}` | `/W${string}` | `/X${string}` | `/Y${string}` | `/Z${string}` | `/a${string}` | `/b${string}` | `/c${string}` | `/d${string}` | `/e${string}` | `/f${string}` | `/g${string}` | `/h${string}` | `/i${string}` | `/j${string}` | `/k${string}` | `/l${string}` | `/m${string}` | `/n${string}` | `/o${string}` | `/p${string}` | `/q${string}` | `/r${string}` | `/s${string}` | `/t${string}` | `/u${string}` | `/v${string}` | `/w${string}` | `/y${string}` | `/z${string}` | `/_${string}` | `/@${string}` | `/.${string}`);
35
+ /**
36
+ * **isDomainName**`(val)`
37
+ *
38
+ * Type guard which checks whether the value is a valid DNS domain name
39
+ */
40
+ export declare const isDomainName: <T>(val: T) => val is T & DomainName<AsString<T>>;
41
+ /**
42
+ * **isUrlSource**`(val)`
43
+ *
44
+ * Type guard which checks whether the value is a valid URL source
45
+ * (aka, an IP address or a Domain Name)
46
+ */
47
+ export declare const isUrlSource: <T>(val: T) => boolean;
48
+ //# sourceMappingURL=network-tg.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"network-tg.d.ts","sourceRoot":"","sources":["../../../src/runtime/type-guards/network-tg.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,YAAY,EAAwC,0BAAuB;AAKtH,OAAO,EAAE,QAAQ,EAAE,6CAA0C;AAQ7D;;;;GAIG;AACH,eAAO,MAAM,YAAY,WAAY,CAAC,yDAKrC,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,YAAY,WAAY,CAAC,qjBAOrC,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,WAAW,WAAY,CAAC,imBAEpC,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,WAAY,CAAC,2FAEnC,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,SAAS,WAAY,CAAC,ojCAalC,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,YAAY,WAAY,CAAC,uCAQrC,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,WAAW,WAAY,CAAC,YAEpC,CAAA"}
@@ -0,0 +1,85 @@
1
+ import { asChars } from "../type-conversion/asChars.js";
2
+ import { isAlpha } from "./isAlpha.js";
3
+ import { isNumericString } from "./isNumericString.js";
4
+ import { isString } from "./isString.js";
5
+ import { ip6GroupExpansion } from "../type-conversion/index.js";
6
+ import { isHexadecimal } from "./isHexadecimal.js";
7
+ import { removeUrlProtocol } from "../meta/index.js";
8
+ /**
9
+ * **isIp4Address**`(val)`
10
+ *
11
+ * Type guard which checks whether the value is a valid IPv4 address.
12
+ */
13
+ export const isIp4Address = (val) => {
14
+ return isString(val) &&
15
+ (val.split(".").length === 4) &&
16
+ (val.split(".").every(i => isNumericString(i))) &&
17
+ val.split(".").every(i => Number(i) >= 0 && Number(i) <= 255);
18
+ };
19
+ /**
20
+ * **isIp6Address**`(val)`
21
+ *
22
+ * Type guard which checks whether the value is a valid IPv6 address.
23
+ */
24
+ export const isIp6Address = (val) => {
25
+ const expanded = isString(val)
26
+ ? ip6GroupExpansion(val)
27
+ : "";
28
+ return isString(val) && isString(expanded) &&
29
+ (expanded.split(":").every(i => asChars(i).length >= 1 && asChars(i).length <= 4)) &&
30
+ expanded.split(":").every(i => isHexadecimal(i));
31
+ };
32
+ /**
33
+ * **isIpAddress**`(val)`
34
+ *
35
+ * Type guard which checks whether the value is a valid IP address (v4 or v6).
36
+ */
37
+ export const isIpAddress = (val) => {
38
+ return isIp4Address(val) || isIp6Address(val);
39
+ };
40
+ /**
41
+ * **hasUrlPort**`(val)`
42
+ *
43
+ * Type guard which tests whether there is an explicit _port_ reference
44
+ * in the passed in URL (versus implicitly using the default port of the
45
+ * protocol)
46
+ */
47
+ export const hasUrlPort = (val) => {
48
+ return isString(val) && asChars(removeUrlProtocol(val)).some(i => i === ":");
49
+ };
50
+ /**
51
+ * **isUrlPath**`(val)`
52
+ *
53
+ * Type guard which checks whether the value is a valid `UrlPath`
54
+ */
55
+ export const isUrlPath = (val) => {
56
+ return isString(val) &&
57
+ (val === "" || val.startsWith("/")) &&
58
+ (asChars(val).every(c => isAlpha(c) ||
59
+ isNumericString(c) ||
60
+ c === "_" ||
61
+ c === "@" ||
62
+ c === "." ||
63
+ c === "-"));
64
+ };
65
+ /**
66
+ * **isDomainName**`(val)`
67
+ *
68
+ * Type guard which checks whether the value is a valid DNS domain name
69
+ */
70
+ export const isDomainName = (val) => {
71
+ return isString(val) &&
72
+ val.split(".").filter(i => i).length > 1 &&
73
+ isString(val.split(".").filter(i => i).pop()) &&
74
+ asChars(val.split(".").filter(i => i).pop()).length > 1 &&
75
+ val.split(".").filter(i => i).every(i => isAlpha(i) || isNumericString(i) || i === "-" || i === "_");
76
+ };
77
+ /**
78
+ * **isUrlSource**`(val)`
79
+ *
80
+ * Type guard which checks whether the value is a valid URL source
81
+ * (aka, an IP address or a Domain Name)
82
+ */
83
+ export const isUrlSource = (val) => {
84
+ return isDomainName(val) || isIpAddress(val);
85
+ };
@@ -0,0 +1,45 @@
1
+ /**
2
+ * **isRepoSource**`(val)`
3
+ *
4
+ * Type guard which validates whether the value passed in is a
5
+ * `RepoSource`.
6
+ */
7
+ export declare const isRepoSource: <T>(v: T) => v is T & ("github" | "bitbucket" | "gitlab" | "codecommit" | "local");
8
+ /**
9
+ * **isSemanticVersion**`(val,[allowPrefix]=false)`
10
+ *
11
+ * Type guard which validates whether the value passed in is a
12
+ * semantic version number.
13
+ *
14
+ * - the optional `allowPrefix` parameter allows for a lowercase "v"
15
+ * to be prefixed to the version so that values like `v1.0.12` and
16
+ * `v 1.0.12` are allowed.
17
+ * - by default the `allowPrefix` option is set to false
18
+ */
19
+ export declare const isSemanticVersion: <T, P extends boolean>(v: T, allowPrefix?: P) => v is T & `${[P] extends [true] ? import("../../types/index").OptionalSpace | "v" | "v " : ""}${number}.${number}.${number}`;
20
+ /**
21
+ * **isRepoUrl**`(val)`
22
+ *
23
+ * Type guard which validates that the value passed in is a valid Repo URL
24
+ */
25
+ export declare const isRepoUrl: <T>(val: T) => val is T & (`https://github.com/${string}` | "https://github.com" | `https://github.com?${string}` | `https://github.io/${string}` | "https://github.io" | `https://github.io?${string}` | `https://bitbucket.com/${string}` | "https://bitbucket.com" | `https://bitbucket.com?${string}` | `https://gitlab.com/${string}` | "https://gitlab.com" | `https://gitlab.com?${string}` | `https://aws.amazon.com/codecommit/${string}` | `https://aws.amazon.com/codecommit/?${string}`);
26
+ /**
27
+ * **isGithubUrl**`(val)`
28
+ *
29
+ * Type guard which validates that the value passed in is a valid Github URL
30
+ */
31
+ export declare const isGithubUrl: <T>(val: T) => val is T & (`https://github.com/${string}` | "https://github.com" | `https://github.com?${string}` | `https://github.io/${string}` | "https://github.io" | `https://github.io?${string}`);
32
+ export declare const isGithubRepoUrl: <T>(val: T) => val is T & (`https://github.com/${string}/0${string}` | `https://github.com/${string}/1${string}` | `https://github.com/${string}/2${string}` | `https://github.com/${string}/3${string}` | `https://github.com/${string}/4${string}` | `https://github.com/${string}/5${string}` | `https://github.com/${string}/6${string}` | `https://github.com/${string}/7${string}` | `https://github.com/${string}/8${string}` | `https://github.com/${string}/9${string}` | `https://github.com/${string}/x${string}` | `https://github.com/${string}/E${string}` | `https://github.com/${string}/A${string}` | `https://github.com/${string}/B${string}` | `https://github.com/${string}/C${string}` | `https://github.com/${string}/D${string}` | `https://github.com/${string}/F${string}` | `https://github.com/${string}/G${string}` | `https://github.com/${string}/H${string}` | `https://github.com/${string}/I${string}` | `https://github.com/${string}/J${string}` | `https://github.com/${string}/K${string}` | `https://github.com/${string}/L${string}` | `https://github.com/${string}/M${string}` | `https://github.com/${string}/N${string}` | `https://github.com/${string}/O${string}` | `https://github.com/${string}/P${string}` | `https://github.com/${string}/Q${string}` | `https://github.com/${string}/R${string}` | `https://github.com/${string}/S${string}` | `https://github.com/${string}/T${string}` | `https://github.com/${string}/U${string}` | `https://github.com/${string}/V${string}` | `https://github.com/${string}/W${string}` | `https://github.com/${string}/X${string}` | `https://github.com/${string}/Y${string}` | `https://github.com/${string}/Z${string}` | `https://github.com/${string}/a${string}` | `https://github.com/${string}/b${string}` | `https://github.com/${string}/c${string}` | `https://github.com/${string}/d${string}` | `https://github.com/${string}/e${string}` | `https://github.com/${string}/f${string}` | `https://github.com/${string}/g${string}` | `https://github.com/${string}/h${string}` | `https://github.com/${string}/i${string}` | `https://github.com/${string}/j${string}` | `https://github.com/${string}/k${string}` | `https://github.com/${string}/l${string}` | `https://github.com/${string}/m${string}` | `https://github.com/${string}/n${string}` | `https://github.com/${string}/o${string}` | `https://github.com/${string}/p${string}` | `https://github.com/${string}/q${string}` | `https://github.com/${string}/r${string}` | `https://github.com/${string}/s${string}` | `https://github.com/${string}/t${string}` | `https://github.com/${string}/u${string}` | `https://github.com/${string}/v${string}` | `https://github.com/${string}/w${string}` | `https://github.com/${string}/y${string}` | `https://github.com/${string}/z${string}`);
33
+ /**
34
+ * **isBitbucketUrl**`(val)`
35
+ *
36
+ * Type guard which validates that the value passed in is a valid BitBucket URL
37
+ */
38
+ export declare const isBitbucketUrl: <T>(val: T) => val is T & (`https://bitbucket.com/${string}` | "https://bitbucket.com" | `https://bitbucket.com?${string}`);
39
+ /**
40
+ * **isCodeCommitUrl**`(val)`
41
+ *
42
+ * Type guard which validates that the value passed in is a valid AWS Code Commit URL
43
+ */
44
+ export declare const isCodeCommitUrl: <T>(val: T) => val is T & (`https://aws.amazon.com/codecommit/${string}` | `https://aws.amazon.com/codecommit/?${string}`);
45
+ //# sourceMappingURL=repos.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repos.d.ts","sourceRoot":"","sources":["../../../src/runtime/type-guards/repos.ts"],"names":[],"mappings":"AAYA;;;;;GAKG;AACH,eAAO,MAAM,YAAY,SAAU,CAAC,0EAEnC,CAAA;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,iBAAiB,4BAC1B,CAAC,gBACU,CAAC,gIAcf,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,SAAS,WAAY,CAAC,0dAMlC,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,WAAW,WAAY,CAAC,8LAMpC,CAAA;AAED,eAAO,MAAM,eAAe,WAAY,CAAC,urFAMxC,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,cAAc,WAAY,CAAC,iHAMvC,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,WAAY,CAAC,gHAMxC,CAAA"}
@@ -0,0 +1,77 @@
1
+ import { isString } from "./isString.js";
2
+ import { REPO_SOURCES, REPO_SOURCE_LOOKUP } from "../../constants/index.js";
3
+ import { stripLeading } from "../literals/index.js";
4
+ import { valuesOf } from "../dictionary/index.js";
5
+ /**
6
+ * **isRepoSource**`(val)`
7
+ *
8
+ * Type guard which validates whether the value passed in is a
9
+ * `RepoSource`.
10
+ */
11
+ export const isRepoSource = (v) => {
12
+ return isString(v) && REPO_SOURCES.includes(v);
13
+ };
14
+ /**
15
+ * **isSemanticVersion**`(val,[allowPrefix]=false)`
16
+ *
17
+ * Type guard which validates whether the value passed in is a
18
+ * semantic version number.
19
+ *
20
+ * - the optional `allowPrefix` parameter allows for a lowercase "v"
21
+ * to be prefixed to the version so that values like `v1.0.12` and
22
+ * `v 1.0.12` are allowed.
23
+ * - by default the `allowPrefix` option is set to false
24
+ */
25
+ export const isSemanticVersion = (v, allowPrefix = false) => {
26
+ return (isString(v) &&
27
+ v.split(".").length === 3 &&
28
+ !Number.isNaN(Number(v.split(".")[1])) &&
29
+ !Number.isNaN(Number(v.split(".")[2])) &&
30
+ (!Number.isNaN(Number(v.split(".")[0])) ||
31
+ (allowPrefix && !Number.isNaN(Number(stripLeading(v.split(".")[0], "v").trim())))));
32
+ };
33
+ /**
34
+ * **isRepoUrl**`(val)`
35
+ *
36
+ * Type guard which validates that the value passed in is a valid Repo URL
37
+ */
38
+ export const isRepoUrl = (val) => {
39
+ const baseUrls = valuesOf(REPO_SOURCE_LOOKUP).flat();
40
+ return isString(val) && baseUrls.every(u => val === u ||
41
+ val.startsWith(`${u}/`));
42
+ };
43
+ /**
44
+ * **isGithubUrl**`(val)`
45
+ *
46
+ * Type guard which validates that the value passed in is a valid Github URL
47
+ */
48
+ export const isGithubUrl = (val) => {
49
+ const baseUrls = REPO_SOURCE_LOOKUP["github"];
50
+ return isString(val) && baseUrls.every(u => val === u ||
51
+ val.startsWith(`${u}/`));
52
+ };
53
+ export const isGithubRepoUrl = (val) => {
54
+ const baseUrls = [""];
55
+ return isString(val) && baseUrls.every(u => val === u ||
56
+ val.startsWith(`${u}/`));
57
+ };
58
+ /**
59
+ * **isBitbucketUrl**`(val)`
60
+ *
61
+ * Type guard which validates that the value passed in is a valid BitBucket URL
62
+ */
63
+ export const isBitbucketUrl = (val) => {
64
+ const baseUrls = REPO_SOURCE_LOOKUP["bitbucket"];
65
+ return isString(val) && baseUrls.every(u => val === u ||
66
+ val.startsWith(`${u}/`));
67
+ };
68
+ /**
69
+ * **isCodeCommitUrl**`(val)`
70
+ *
71
+ * Type guard which validates that the value passed in is a valid AWS Code Commit URL
72
+ */
73
+ export const isCodeCommitUrl = (val) => {
74
+ const baseUrls = REPO_SOURCE_LOOKUP["codecommit"];
75
+ return isString(val) && baseUrls.every(u => val === u ||
76
+ val.startsWith(`${u}/`));
77
+ };
@@ -0,0 +1,42 @@
1
+ import { YouTubeFeedType, YouTubeFeedUrl, YouTubePlaylistUrl } from "../../types/index";
2
+ /**
3
+ * **isYouTubeUrl**`(val)`
4
+ *
5
+ * Type guard which checks whether the passed in value is a valid
6
+ * YouTube URL.
7
+ */
8
+ export declare const isYouTubeUrl: <T>(val: T) => val is T & (`https://www.youtube.com/${string}` | "https://www.youtube.com" | `https://www.youtube.com?${string}` | `https://youtube.com/${string}` | "https://youtube.com" | `https://youtube.com?${string}` | `https://youtu.be/${string}` | "https://youtu.be" | `https://youtu.be?${string}`);
9
+ /**
10
+ * **isYouTubeShareUrl**`(val)`
11
+ *
12
+ * Type guard which checks whether the passed in value is a URL
13
+ * from YouTube's _URL shortening_ site `https://youtu.be`.
14
+ */
15
+ export declare const isYouTubeShareUrl: <T>(val: T) => val is T & (`https://youtu.be/${string}` | "https://youtu.be" | `https://youtu.be?${string}`);
16
+ /**
17
+ * **isYouTubeVideoUrl**`(val)`
18
+ *
19
+ * Type guard which checks whether the passed in value is a valid
20
+ * YouTube URL _which plays video_.
21
+ */
22
+ export declare const isYouTubeVideoUrl: <T>(val: T) => val is T & (`https://www.youtube.com/${string}` | "https://www.youtube.com" | `https://www.youtube.com?${string}` | `https://youtube.com/${string}` | "https://youtube.com" | `https://youtube.com?${string}` | `https://youtu.be/${string}` | "https://youtu.be" | `https://youtu.be?${string}`);
23
+ /**
24
+ * **isYouTubePlaylistUrl**`(val)`
25
+ *
26
+ * Type guard which checks whether the passed in value is a valid
27
+ * YouTube URL which points to a "playlist" on the platform.
28
+ */
29
+ export declare const isYouTubePlaylistUrl: <T>(val: T) => val is T & YouTubePlaylistUrl;
30
+ /**
31
+ * **isYouTubeFeedUrl**`(val,[kind])**
32
+ *
33
+ * Type guard which checks whether the passed in value is a valid
34
+ * YouTube URL which responds with "feed" content. This is content
35
+ * which is available to a logged in user and helps them see lists
36
+ * of videos related to their settings.
37
+ *
38
+ * By default any "feed" URL is matched but you can narrow that down
39
+ * to a specific feed type by specifying the `kind` variable.
40
+ */
41
+ export declare const isYouTubeFeedUrl: <T, U extends YouTubeFeedType = YouTubeFeedType>(val: T, kind?: U) => val is T & YouTubeFeedUrl<U>;
42
+ //# sourceMappingURL=youtube.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"youtube.d.ts","sourceRoot":"","sources":["../../../src/runtime/type-guards/youtube.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,kBAAkB,EAA+B,0BAAwB;AAInH;;;;;GAKG;AACH,eAAO,MAAM,YAAY,WAAY,CAAC,sSAMrC,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,WAAW,CAAC,kGAEzC,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,WAAY,CAAC,sSAM1C,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,WAAY,CAAC,kCAS7C,CAAA;AAeD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gBAAgB,wDAIvB,CAAC,SACE,CAAC,iCAMT,CAAA"}
@@ -0,0 +1,74 @@
1
+ import { isString } from "./isString.js";
2
+ import { isUndefined } from "./isUndefined.js";
3
+ /**
4
+ * **isYouTubeUrl**`(val)`
5
+ *
6
+ * Type guard which checks whether the passed in value is a valid
7
+ * YouTube URL.
8
+ */
9
+ export const isYouTubeUrl = (val) => {
10
+ return isString(val) && (val.startsWith("https://www.youtube.com") ||
11
+ val.startsWith("https://youtube.com") ||
12
+ val.startsWith("https://youtu.be"));
13
+ };
14
+ /**
15
+ * **isYouTubeShareUrl**`(val)`
16
+ *
17
+ * Type guard which checks whether the passed in value is a URL
18
+ * from YouTube's _URL shortening_ site `https://youtu.be`.
19
+ */
20
+ export const isYouTubeShareUrl = (val) => {
21
+ return isString(val) && val.startsWith(`https://youtu.be`);
22
+ };
23
+ /**
24
+ * **isYouTubeVideoUrl**`(val)`
25
+ *
26
+ * Type guard which checks whether the passed in value is a valid
27
+ * YouTube URL _which plays video_.
28
+ */
29
+ export const isYouTubeVideoUrl = (val) => {
30
+ return isString(val) && (val.startsWith("https://www.youtube.com") ||
31
+ val.startsWith("https://youtube.com") ||
32
+ val.startsWith("https://youtu.be"));
33
+ };
34
+ /**
35
+ * **isYouTubePlaylistUrl**`(val)`
36
+ *
37
+ * Type guard which checks whether the passed in value is a valid
38
+ * YouTube URL which points to a "playlist" on the platform.
39
+ */
40
+ export const isYouTubePlaylistUrl = (val) => {
41
+ return isString(val) && (val === `https://www.youtube.com/feed/playlists` ||
42
+ val === `https://youtube.com/feed/playlists` ||
43
+ val === `https://www.youtube.com/channel/playlists` ||
44
+ val === `https://youtube.com/channel/playlists` ||
45
+ (val.startsWith(`https://www.youtube.com/@`) && val.endsWith(`/playlists`)) ||
46
+ (val.startsWith(`https://youtube.com/@`) && val.endsWith(`/playlists`)));
47
+ };
48
+ /**
49
+ * maps the "feed type" to a URL path
50
+ */
51
+ const feed_map = (type) => {
52
+ return isUndefined(type)
53
+ ? `/feed`
54
+ : type === "liked"
55
+ ? `/playlist?list=LL`
56
+ : ["history", "playlists", "trending", "subscriptions"].includes(type)
57
+ ? `/feed/${type}`
58
+ : `/feed/`;
59
+ };
60
+ /**
61
+ * **isYouTubeFeedUrl**`(val,[kind])**
62
+ *
63
+ * Type guard which checks whether the passed in value is a valid
64
+ * YouTube URL which responds with "feed" content. This is content
65
+ * which is available to a logged in user and helps them see lists
66
+ * of videos related to their settings.
67
+ *
68
+ * By default any "feed" URL is matched but you can narrow that down
69
+ * to a specific feed type by specifying the `kind` variable.
70
+ */
71
+ export const isYouTubeFeedUrl = (val, kind) => {
72
+ return isString(val) && (val.startsWith(`https://www.youtube.com/${feed_map(kind)}`) ||
73
+ val.startsWith(`https://youtube.com/feed${feed_map(kind)}`));
74
+ };
@@ -96,4 +96,4 @@ export type ApiReturn<T extends Dictionary | TypedFunction> = ApiEscape<T> exten
96
96
  */
97
97
  export type HandleApiCallback<TReturn> = TReturn extends Dictionary | TypedFunction ? GetEscapeFunction<TReturn> extends TypedFunction ? ReturnType<GetEscapeFunction<TReturn>> : TReturn : TReturn;
98
98
  export {};
99
- //# sourceMappingURL=ValueCallback.d.ts.map
99
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/types/api/api.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,WAAW,EACX,aAAa,EACb,QAAQ,EACR,OAAO,EACP,MAAM,EACN,KAAK,EACL,UAAU,EACV,KAAK,EACL,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,MAAM,EACN,YAAY,EACb,iBAAwB;AAEzB;;;;;;;;;GASG;AACH,MAAM,MAAM,aAAa,CACvB,IAAI,EACJ,OAAO,IACL,CAAC,CAAC,SAAS,IAAI,EAAE,CAAC,EAAE,CAAC,KAAK,OAAO,CAAC;AAEtC,MAAM,MAAM,cAAc,CACxB,CAAC,SAAS,MAAM,GAAG,GAAG,MAAM,GAAG,IAC7B,CAAC,GAAG;IAAE,MAAM,EAAE,IAAI,CAAA;CAAE,CAAA;AAExB;;;;GAIG;AACH,MAAM,MAAM,iBAAi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