inferred-types 0.44.0 → 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 (134) 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/index.d.ts +1 -1
  5. package/dist/constants/index.d.ts.map +1 -1
  6. package/dist/constants/index.js +1 -1
  7. package/dist/constants/tsconfig.tsbuildinfo +1 -1
  8. package/dist/inferred-types/index.cjs +571 -301
  9. package/dist/inferred-types/tsconfig.tsbuildinfo +1 -1
  10. package/dist/runtime/dictionary/withKeys.d.ts +1 -1
  11. package/dist/runtime/index.d.ts +1 -0
  12. package/dist/runtime/index.d.ts.map +1 -1
  13. package/dist/runtime/index.js +1 -0
  14. package/dist/runtime/literals/index.d.ts +1 -0
  15. package/dist/runtime/literals/index.d.ts.map +1 -1
  16. package/dist/runtime/literals/index.js +1 -0
  17. package/dist/runtime/literals/takeNumericCharacters.d.ts +9 -0
  18. package/dist/runtime/literals/takeNumericCharacters.d.ts.map +1 -0
  19. package/dist/runtime/literals/takeNumericCharacters.js +12 -0
  20. package/dist/runtime/meta/index.d.ts +3 -0
  21. package/dist/runtime/meta/index.d.ts.map +1 -0
  22. package/dist/runtime/meta/index.js +2 -0
  23. package/dist/runtime/meta/urlMeta.d.ts +52 -0
  24. package/dist/runtime/meta/urlMeta.d.ts.map +1 -0
  25. package/dist/runtime/meta/urlMeta.js +57 -0
  26. package/dist/runtime/meta/youtube-meta.d.ts +31 -0
  27. package/dist/runtime/meta/youtube-meta.d.ts.map +1 -0
  28. package/dist/runtime/meta/youtube-meta.js +19 -0
  29. package/dist/runtime/runtime-types/parse.d.ts +1 -1
  30. package/dist/runtime/runtime-types/shape-helpers/getTokenData.d.ts +1 -1
  31. package/dist/runtime/runtime-types/shape-helpers/getTokenName.d.ts +1 -1
  32. package/dist/runtime/runtime-types/shape-helpers/singletons.d.ts.map +1 -1
  33. package/dist/runtime/runtime-types/shape-helpers/singletons.js +1 -1
  34. package/dist/runtime/runtime-types/shape.d.ts +1 -1
  35. package/dist/runtime/tsconfig.tsbuildinfo +1 -1
  36. package/dist/runtime/type-conversion/asChars.d.ts +8 -0
  37. package/dist/runtime/type-conversion/asChars.d.ts.map +1 -0
  38. package/dist/runtime/type-conversion/asChars.js +8 -0
  39. package/dist/runtime/type-conversion/index.d.ts +2 -0
  40. package/dist/runtime/type-conversion/index.d.ts.map +1 -1
  41. package/dist/runtime/type-conversion/index.js +2 -0
  42. package/dist/runtime/type-conversion/ip6GroupExpansion.d.ts +14 -0
  43. package/dist/runtime/type-conversion/ip6GroupExpansion.d.ts.map +1 -0
  44. package/dist/runtime/type-conversion/ip6GroupExpansion.js +15 -0
  45. package/dist/runtime/type-guards/index.d.ts +4 -0
  46. package/dist/runtime/type-guards/index.d.ts.map +1 -1
  47. package/dist/runtime/type-guards/index.js +4 -0
  48. package/dist/runtime/type-guards/isHexadecimal.d.ts +8 -0
  49. package/dist/runtime/type-guards/isHexadecimal.d.ts.map +1 -0
  50. package/dist/runtime/type-guards/isHexadecimal.js +13 -0
  51. package/dist/runtime/type-guards/isUrl.d.ts +1 -3
  52. package/dist/runtime/type-guards/isUrl.d.ts.map +1 -1
  53. package/dist/runtime/type-guards/isUrl.js +2 -3
  54. package/dist/runtime/type-guards/network-tg.d.ts +48 -0
  55. package/dist/runtime/type-guards/network-tg.d.ts.map +1 -0
  56. package/dist/runtime/type-guards/network-tg.js +85 -0
  57. package/dist/runtime/type-guards/repos.d.ts +4 -4
  58. package/dist/runtime/type-guards/repos.d.ts.map +1 -1
  59. package/dist/runtime/type-guards/youtube.d.ts +42 -0
  60. package/dist/runtime/type-guards/youtube.d.ts.map +1 -0
  61. package/dist/runtime/type-guards/youtube.js +74 -0
  62. package/dist/types/boolean-logic/combinators/And.d.ts +1 -1
  63. package/dist/types/boolean-logic/combinators/And.d.ts.map +1 -1
  64. package/dist/types/boolean-logic/combinators/Not.d.ts +5 -6
  65. package/dist/types/boolean-logic/combinators/Not.d.ts.map +1 -1
  66. package/dist/types/boolean-logic/operators/Extends.d.ts +2 -1
  67. package/dist/types/boolean-logic/operators/Extends.d.ts.map +1 -1
  68. package/dist/types/boolean-logic/operators/IsBoolean.d.ts +2 -1
  69. package/dist/types/boolean-logic/operators/IsBoolean.d.ts.map +1 -1
  70. package/dist/types/boolean-logic/operators/IsCssHexadecimal.d.ts +9 -0
  71. package/dist/types/boolean-logic/operators/IsCssHexadecimal.d.ts.map +1 -0
  72. package/dist/types/boolean-logic/operators/IsEqual.d.ts +7 -1
  73. package/dist/types/boolean-logic/operators/IsEqual.d.ts.map +1 -1
  74. package/dist/types/boolean-logic/operators/IsLessThan.d.ts +13 -0
  75. package/dist/types/boolean-logic/operators/IsLessThan.d.ts.map +1 -0
  76. package/dist/types/boolean-logic/operators/IsLessThan.js +1 -0
  77. package/dist/types/boolean-logic/operators/IsNever.d.ts +2 -1
  78. package/dist/types/boolean-logic/operators/IsNever.d.ts.map +1 -1
  79. package/dist/types/boolean-logic/operators/IsNumber.d.ts +2 -2
  80. package/dist/types/boolean-logic/operators/IsNumber.d.ts.map +1 -1
  81. package/dist/types/boolean-logic/operators/IsString.d.ts +2 -2
  82. package/dist/types/boolean-logic/operators/IsString.d.ts.map +1 -1
  83. package/dist/types/boolean-logic/operators/IsUrl.d.ts +35 -0
  84. package/dist/types/boolean-logic/operators/IsUrl.d.ts.map +1 -0
  85. package/dist/types/boolean-logic/operators/IsUrl.js +1 -0
  86. package/dist/types/boolean-logic/operators/Network-operators.d.ts +71 -0
  87. package/dist/types/boolean-logic/operators/Network-operators.d.ts.map +1 -0
  88. package/dist/types/boolean-logic/operators/Network-operators.js +1 -0
  89. package/dist/types/boolean-logic/operators/YouTube-operators.d.ts +32 -0
  90. package/dist/types/boolean-logic/operators/YouTube-operators.d.ts.map +1 -0
  91. package/dist/types/boolean-logic/operators/YouTube-operators.js +1 -0
  92. package/dist/types/boolean-logic/operators/index.d.ts +4 -1
  93. package/dist/types/boolean-logic/operators/index.d.ts.map +1 -1
  94. package/dist/types/boolean-logic/operators/index.js +4 -1
  95. package/dist/types/string-literals/RetainUntil.d.ts +33 -0
  96. package/dist/types/string-literals/RetainUntil.d.ts.map +1 -0
  97. package/dist/types/string-literals/RetainUntil.js +1 -0
  98. package/dist/types/string-literals/Split.d.ts +3 -3
  99. package/dist/types/string-literals/Split.d.ts.map +1 -1
  100. package/dist/types/string-literals/StripAfter.d.ts +2 -2
  101. package/dist/types/string-literals/StripAfter.d.ts.map +1 -1
  102. package/dist/types/string-literals/StripBefore.d.ts +2 -2
  103. package/dist/types/string-literals/StripBefore.d.ts.map +1 -1
  104. package/dist/types/string-literals/StripUntil.d.ts +6 -0
  105. package/dist/types/string-literals/StripUntil.d.ts.map +1 -0
  106. package/dist/types/string-literals/StripUntil.js +1 -0
  107. package/dist/types/string-literals/character-sets/DomainName.d.ts +17 -18
  108. package/dist/types/string-literals/character-sets/DomainName.d.ts.map +1 -1
  109. package/dist/types/string-literals/character-sets/IpAddress.d.ts +28 -4
  110. package/dist/types/string-literals/character-sets/IpAddress.d.ts.map +1 -1
  111. package/dist/types/string-literals/character-sets/Optional.d.ts +14 -0
  112. package/dist/types/string-literals/character-sets/Optional.d.ts.map +1 -0
  113. package/dist/types/string-literals/character-sets/Optional.js +1 -0
  114. package/dist/types/string-literals/character-sets/Repos.d.ts.map +1 -1
  115. package/dist/types/string-literals/character-sets/Url.d.ts +85 -37
  116. package/dist/types/string-literals/character-sets/Url.d.ts.map +1 -1
  117. package/dist/types/string-literals/character-sets/Url.js +1 -0
  118. package/dist/types/string-literals/character-sets/YouTube.d.ts +127 -0
  119. package/dist/types/string-literals/character-sets/YouTube.d.ts.map +1 -0
  120. package/dist/types/string-literals/character-sets/YouTube.js +1 -0
  121. package/dist/types/string-literals/character-sets/index.d.ts +2 -0
  122. package/dist/types/string-literals/character-sets/index.d.ts.map +1 -1
  123. package/dist/types/string-literals/character-sets/index.js +2 -0
  124. package/dist/types/string-literals/index.d.ts +2 -0
  125. package/dist/types/string-literals/index.d.ts.map +1 -1
  126. package/dist/types/string-literals/index.js +2 -0
  127. package/dist/types/tsconfig.tsbuildinfo +1 -1
  128. package/package.json +1 -1
  129. package/dist/constants/Network.d.ts +0 -22
  130. package/dist/constants/Network.d.ts.map +0 -1
  131. package/dist/constants/Network.js +0 -21
  132. package/dist/types/boolean-logic/operators/IsHexadecimal.d.ts +0 -9
  133. package/dist/types/boolean-logic/operators/IsHexadecimal.d.ts.map +0 -1
  134. /package/dist/types/boolean-logic/operators/{IsHexadecimal.js → IsCssHexadecimal.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,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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kB,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,6 +1,4 @@
1
- import { NetworkProtocol } from "../../types/string-literals";
2
- import { TupleToUnion } from "../../types/type-conversion";
3
- import { Keys } from "../../types/index";
1
+ import { Keys, TupleToUnion, NetworkProtocol } from "../../types/index";
4
2
  /**
5
3
  * **isUri**`(val, ...protocols)`
6
4
  *
@@ -1 +1 @@
1
- {"version":3,"file":"isUrl.d.ts","sourceRoot":"","sources":["../../../src/runtime/type-guards/isUrl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAO,oCAAkC;AAIjE,OAAO,EAAE,YAAY,EAAE,oCAAkC;AACzD,OAAO,EAAE,IAAI,EAAE,0BAAwB;AAEvC;;;;;;;;;;GAUG;AACH,eAAO,MAAM,KAAK,iDAGX,CAAC,gBAAgB,CAAC,gGAUxB,CAAA;AAGD;;;;;;;;;GASG;AACH,eAAO,MAAM,KAAK,iDAGX,CAAC,gBAAgB,CAAC,iGAUxB,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,6 +1,5 @@
1
- import { isString } from "./isString.js";
2
- import { NETWORK_PROTOCOL_LOOKUP } from "../../constants/Network.js";
3
- import { valuesOf } from "../dictionary/valuesOf.js";
1
+ import { isString, valuesOf } from "../index.js";
2
+ import { NETWORK_PROTOCOL_LOOKUP } from "../../constants/index.js";
4
3
  /**
5
4
  * **isUri**`(val, ...protocols)`
6
5
  *
@@ -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
+ };
@@ -22,24 +22,24 @@ export declare const isSemanticVersion: <T, P extends boolean>(v: T, allowPrefix
22
22
  *
23
23
  * Type guard which validates that the value passed in is a valid Repo URL
24
24
  */
25
- export declare const isRepoUrl: <T>(val: T) => val is T & (`https://github.com/${string}` | "https://github.com" | `https://github.io/${string}` | "https://github.io" | `https://bitbucket.com/${string}` | "https://bitbucket.com" | `https://gitlab.com/${string}` | "https://gitlab.com" | `https://aws.amazon.com/codecommit/${string}`);
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
26
  /**
27
27
  * **isGithubUrl**`(val)`
28
28
  *
29
29
  * Type guard which validates that the value passed in is a valid Github URL
30
30
  */
31
- export declare const isGithubUrl: <T>(val: T) => val is T & (`https://github.com/${string}` | "https://github.com" | `https://github.io/${string}` | "https://github.io");
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
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
33
  /**
34
34
  * **isBitbucketUrl**`(val)`
35
35
  *
36
36
  * Type guard which validates that the value passed in is a valid BitBucket URL
37
37
  */
38
- export declare const isBitbucketUrl: <T>(val: T) => val is T & (`https://bitbucket.com/${string}` | "https://bitbucket.com");
38
+ export declare const isBitbucketUrl: <T>(val: T) => val is T & (`https://bitbucket.com/${string}` | "https://bitbucket.com" | `https://bitbucket.com?${string}`);
39
39
  /**
40
40
  * **isCodeCommitUrl**`(val)`
41
41
  *
42
42
  * Type guard which validates that the value passed in is a valid AWS Code Commit URL
43
43
  */
44
- export declare const isCodeCommitUrl: <T>(val: T) => val is T & `https://aws.amazon.com/codecommit/${string}`;
44
+ export declare const isCodeCommitUrl: <T>(val: T) => val is T & (`https://aws.amazon.com/codecommit/${string}` | `https://aws.amazon.com/codecommit/?${string}`);
45
45
  //# sourceMappingURL=repos.d.ts.map
@@ -1 +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,mSAMlC,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,WAAW,WAAY,CAAC,6HAMpC,CAAA;AAED,eAAO,MAAM,eAAe,WAAY,CAAC,urFAMxC,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,cAAc,WAAY,CAAC,6EAMvC,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,WAAY,CAAC,6DAMxC,CAAA"}
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,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
+ };
@@ -6,6 +6,6 @@ type Process<TConditions extends readonly boolean[], TBooleanSeen extends boolea
6
6
  * Allows an array of conditions which are either ARE a boolean value or a
7
7
  * function which evaluates to a boolean value to be logically AND'd together.
8
8
  */
9
- export type And<TConditions extends readonly (boolean | LogicFunction)[], TEmpty extends boolean = false> = IsEqual<TConditions, []> extends true ? TEmpty : LogicalReturns<TConditions> extends readonly boolean[] ? Process<LogicalReturns<TConditions>, NarrowlyContains<LogicalReturns<TConditions>, boolean>> : never;
9
+ export type And<TConditions, TEmpty extends boolean = false> = TConditions extends readonly (boolean | LogicFunction)[] ? IsEqual<TConditions, []> extends true ? TEmpty : LogicalReturns<TConditions> extends readonly boolean[] ? Process<LogicalReturns<TConditions>, NarrowlyContains<LogicalReturns<TConditions>, boolean>> : never : never;
10
10
  export {};
11
11
  //# sourceMappingURL=And.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"And.d.ts","sourceRoot":"","sources":["../../../../src/types/boolean-logic/combinators/And.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,KAAK,EACL,OAAO,EACP,OAAO,EACP,aAAa,EACb,cAAc,EACd,gBAAgB,EACjB,oBAAwB;AAEzB,KAAK,OAAO,CACV,WAAW,SAAS,SAAS,OAAO,EAAE,EACtC,YAAY,SAAS,OAAO,IAC1B,EAAE,SAAS,WAAW,GACxB,OAAO,CAAC,YAAY,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,GAC1C,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GAClC,KAAK,GACL,OAAO,CACL,UAAU,CAAC,WAAW,CAAC,EACvB,YAAY,CACb,CAAC;AAGN;;;;;GAKG;AACH,MAAM,MAAM,GAAG,CACb,WAAW,SAAS,SAAS,CAAC,OAAO,GAAG,aAAa,CAAC,EAAE,EACxD,MAAM,SAAS,OAAO,GAAG,KAAK,IAC5B,OAAO,CAAC,WAAW,EAAC,EAAE,CAAC,SAAS,IAAI,GACtC,MAAM,GACN,cAAc,CAAC,WAAW,CAAC,SAAS,SAAS,OAAO,EAAE,GACpD,OAAO,CACL,cAAc,CAAC,WAAW,CAAC,EAC3B,gBAAgB,CAAC,cAAc,CAAC,WAAW,CAAC,EAAC,OAAO,CAAC,CACtD,GACD,KAAK,CAAC"}
1
+ {"version":3,"file":"And.d.ts","sourceRoot":"","sources":["../../../../src/types/boolean-logic/combinators/And.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,KAAK,EACL,OAAO,EACP,OAAO,EACP,aAAa,EACb,cAAc,EACd,gBAAgB,EACjB,oBAAwB;AAEzB,KAAK,OAAO,CACV,WAAW,SAAS,SAAS,OAAO,EAAE,EACtC,YAAY,SAAS,OAAO,IAC1B,EAAE,SAAS,WAAW,GACxB,OAAO,CAAC,YAAY,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,GAC1C,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GAClC,KAAK,GACL,OAAO,CACL,UAAU,CAAC,WAAW,CAAC,EACvB,YAAY,CACb,CAAC;AAGN;;;;;GAKG;AACH,MAAM,MAAM,GAAG,CACb,WAAW,EACX,MAAM,SAAS,OAAO,GAAG,KAAK,IAC5B,WAAW,SAAS,SAAS,CAAC,OAAO,GAAG,aAAa,CAAC,EAAE,GAE1D,OAAO,CAAC,WAAW,EAAC,EAAE,CAAC,SAAS,IAAI,GACpC,MAAM,GACN,cAAc,CAAC,WAAW,CAAC,SAAS,SAAS,OAAO,EAAE,GACpD,OAAO,CACL,cAAc,CAAC,WAAW,CAAC,EAC3B,gBAAgB,CAAC,cAAc,CAAC,WAAW,CAAC,EAAC,OAAO,CAAC,CACtD,GACD,KAAK,GACP,KAAK,CAAC"}
@@ -1,15 +1,14 @@
1
- import { LogicFunction, IsFalse, IsTrue, IsErrorCondition, AfterFirst, First, IsEqual, IsNever } from "../../index";
2
- type Negate<TVal> = IsNever<TVal> extends true ? never : [TVal] extends [boolean] ? IsTrue<TVal> extends true ? false : IsFalse<TVal> extends true ? true : boolean : [TVal] extends [LogicFunction] ? ReturnType<LogicFunction> : never;
1
+ import { LogicFunction, IsFalse, IsTrue, AfterFirst, First, IsEqual, IsNever, As } from "../../index";
2
+ type Negate<TVal> = IsNever<TVal> extends true ? never : [TVal] extends [boolean] ? IsTrue<TVal> extends true ? false : IsFalse<TVal> extends true ? true : boolean : [TVal] extends [LogicFunction] ? Negate<ReturnType<LogicFunction>> : never;
3
3
  type NegateTuple<TTuple extends readonly (boolean | LogicFunction)[], TResults extends readonly (boolean | LogicFunction)[] = []> = [] extends TTuple ? IsEqual<TResults, [], false, TResults> : NegateTuple<AfterFirst<TTuple>, [
4
4
  ...TResults,
5
- Negate<First<TTuple>>
5
+ First<TTuple> extends LogicFunction ? Negate<ReturnType<First<TTuple>>> : Negate<First<TTuple>>
6
6
  ]>;
7
- type Process<TVal, TError = never> = IsErrorCondition<TVal> extends true ? TError : [IsNever<TVal>] extends [true] ? never : [TVal] extends [boolean] ? Negate<TVal> : TVal extends readonly (boolean | LogicFunction)[] ? NegateTuple<TVal> : never;
8
7
  /**
9
8
  * **Not**`<T,[TError]>`
10
9
  *
11
10
  * A boolean negation that can work on both a single value or an
12
- * array of values.
11
+ * tuple of values.
13
12
  *
14
13
  * ```ts
15
14
  * // false
@@ -18,6 +17,6 @@ type Process<TVal, TError = never> = IsErrorCondition<TVal> extends true ? TErro
18
17
  * type Multi = Not<[true,false,boolean]>;
19
18
  * ```
20
19
  */
21
- export type Not<TVal, TError = never> = Process<TVal, TError> extends boolean | readonly unknown[] ? Process<TVal, TError> : never;
20
+ export type Not<TVal, TNotBoolean extends boolean = false> = [TVal] extends [boolean] ? Exclude<As<Negate<TVal>, boolean>, any[]> : [TVal] extends [LogicFunction] ? As<Negate<ReturnType<TVal>>, boolean> : [TVal] extends [readonly (LogicFunction | boolean)[]] ? As<NegateTuple<TVal>, readonly boolean[]> : TNotBoolean;
22
21
  export {};
23
22
  //# sourceMappingURL=Not.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Not.d.ts","sourceRoot":"","sources":["../../../../src/types/boolean-logic/combinators/Not.ts"],"names":[],"mappings":"AACA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CACzB,CACF,CAAC;AAIJ;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,GAAG,CACb,IAAI,EACJ,WAAW,SAAS,OAAO,GAAG,KAAK,IACjC,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,GAC1B,OAAO,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC,GACzC,CAAC,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,GAC9B,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC,GACrC,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,aAAa,GAAG,OAAO,CAAC,EAAE,CAAC,GACrD,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC,GACzC,WAAW,CAAC"}
@@ -1,9 +1,10 @@
1
1
  import { DoesExtend } from "./DoesExtend";
2
+ import { IsNever } from "./IsNever";
2
3
  /**
3
4
  * **Extends**`<T,U>`
4
5
  *
5
6
  * A boolean operator which checks whether `T` extends `U` and returns
6
7
  * **true** or **false**. This is an _alias_ for `DoesExtend`.
7
8
  */
8
- export type Extends<T, U> = DoesExtend<T, U>;
9
+ export type Extends<T, U> = IsNever<T> extends true ? IsNever<U> extends true ? true : false : DoesExtend<T, U>;
9
10
  //# sourceMappingURL=Extends.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Extends.d.ts","sourceRoot":"","sources":["../../../../src/types/boolean-logic/operators/Extends.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,MAAM,OAAO,CAAC,CAAC,EAAC,CAAC,IAAI,UAAU,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"Extends.d.ts","sourceRoot":"","sources":["../../../../src/types/boolean-logic/operators/Extends.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC;;;;;GAKG;AACH,MAAM,MAAM,OAAO,CAAC,CAAC,EAAC,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,SAAS,IAAI,GAChD,OAAO,CAAC,CAAC,CAAC,SAAS,IAAI,GACrB,IAAI,GACJ,KAAK,GACP,UAAU,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC"}
@@ -1,7 +1,8 @@
1
+ import { WidenUnion, IsUnion } from "../../index";
1
2
  /**
2
3
  * **IsBoolean**
3
4
  *
4
5
  * Boolean type utility which detects literal or wide boolean type.
5
6
  */
6
- export type IsBoolean<T> = [T] extends [boolean] ? true : false;
7
+ export type IsBoolean<T> = [IsUnion<T>] extends [true] ? [WidenUnion<T>] extends [boolean] ? true : [string] extends [WidenUnion<T>] ? boolean : false : [T] extends [boolean] ? true : false;
7
8
  //# sourceMappingURL=IsBoolean.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"IsBoolean.d.ts","sourceRoot":"","sources":["../../../../src/types/boolean-logic/operators/IsBoolean.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,IAAI,GAAG,KAAK,CAAC"}
1
+ {"version":3,"file":"IsBoolean.d.ts","sourceRoot":"","sources":["../../../../src/types/boolean-logic/operators/IsBoolean.ts"],"names":[],"mappings":"AAAA,OAAO,EAAG,UAAU,EAAE,OAAO,EAAE,oBAAwB;AACvD;;;;GAIG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,GACpD,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,GAC/B,IAAI,GACJ,CAAC,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,GAC9B,OAAO,GACP,KAAK,GACT,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,IAAI,GAAG,KAAK,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { IsHexadecimal, IsStringLiteral } from "../../index";
2
+ /**
3
+ * **IsHexadecimal**`<T>`
4
+ *
5
+ * Ensures that `T` is a valid hexadecimal and converts to **never**
6
+ * otherwise.
7
+ */
8
+ export type IsCssHexadecimal<T> = T extends string ? IsStringLiteral<T> extends true ? T extends `#${infer Rest}` ? IsHexadecimal<Rest> : false : boolean : false;
9
+ //# sourceMappingURL=IsCssHexadecimal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IsCssHexadecimal.d.ts","sourceRoot":"","sources":["../../../../src/types/boolean-logic/operators/IsCssHexadecimal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,oBAAuB;AAEhE;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GAChD,eAAe,CAAC,CAAC,CAAC,SAAS,IAAI,GAC7B,CAAC,SAAS,IAAI,MAAM,IAAI,EAAE,GACxB,aAAa,CAAC,IAAI,CAAC,GACnB,KAAK,GACP,OAAO,GACT,KAAK,CAAC"}
@@ -1,7 +1,13 @@
1
1
  /**
2
- * **Equal**`<X,Y>`
2
+ * **IsEqual**`<X,Y>`
3
3
  *
4
4
  * Type utility which tests whether two types -- `X` and `Y` -- are exactly the same type
5
5
  */
6
6
  export type IsEqual<X, Y, TRUE = true, FALSE = false> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? TRUE : FALSE;
7
+ /**
8
+ * **Equals**`<X,Y>`
9
+ *
10
+ * Type utility which tests whether two types -- `X` and `Y` -- are exactly the same type
11
+ */
12
+ export type Equals<X, Y, TTrue = true, TFalse = false> = IsEqual<X, Y, TTrue, TFalse>;
7
13
  //# sourceMappingURL=IsEqual.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"IsEqual.d.ts","sourceRoot":"","sources":["../../../../src/types/boolean-logic/operators/IsEqual.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,OAAO,CACjB,CAAC,EACD,CAAC,EACD,IAAI,GAAG,IAAI,EACX,KAAK,GAAG,KAAK,IACX,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,GACnE,IAAI,GACJ,KAAK,CAAC"}
1
+ {"version":3,"file":"IsEqual.d.ts","sourceRoot":"","sources":["../../../../src/types/boolean-logic/operators/IsEqual.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,MAAM,OAAO,CACjB,CAAC,EACD,CAAC,EACD,IAAI,GAAG,IAAI,EACX,KAAK,GAAG,KAAK,IACX,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,GACnE,IAAI,GACJ,KAAK,CAAC;AAEV;;;;GAIG;AACH,MAAM,MAAM,MAAM,CAAC,CAAC,EAAC,CAAC,EAAC,KAAK,GAAG,IAAI,EAAC,MAAM,GAAG,KAAK,IAAI,OAAO,CAAC,CAAC,EAAC,CAAC,EAAC,KAAK,EAAC,MAAM,CAAC,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { AsNumber } from "../../index";
2
+ type Calc<A extends number, B extends number, Count extends 1[] = []> = Count["length"] extends B ? false : Count["length"] extends A ? true : Calc<A, B, [...Count, 1]>;
3
+ /**
4
+ * **IsLessThan**`<A,B>`
5
+ *
6
+ * Boolean type operator which determines whether `A`
7
+ * is _less than_ `B`.
8
+ *
9
+ * **Note:** does not take negative numbers into account
10
+ */
11
+ export type IsLessThan<A extends number | `${number}`, B extends number | `${number}`> = Calc<AsNumber<A>, AsNumber<B>>;
12
+ export {};
13
+ //# sourceMappingURL=IsLessThan.d.ts.map