@stryke/types 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (225) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +295 -0
  3. package/dist/convert/buffer-to-string.cjs +8 -0
  4. package/dist/convert/buffer-to-string.d.ts +1 -0
  5. package/dist/convert/buffer-to-string.mjs +1 -0
  6. package/dist/convert/index.cjs +71 -0
  7. package/dist/convert/index.d.ts +6 -0
  8. package/dist/convert/index.mjs +1 -0
  9. package/dist/convert/string-to-uint8-array.cjs +8 -0
  10. package/dist/convert/string-to-uint8-array.d.ts +7 -0
  11. package/dist/convert/string-to-uint8-array.mjs +1 -0
  12. package/dist/convert/to-array.cjs +9 -0
  13. package/dist/convert/to-array.d.ts +8 -0
  14. package/dist/convert/to-array.mjs +1 -0
  15. package/dist/convert/to-string-key.cjs +9 -0
  16. package/dist/convert/to-string-key.d.ts +7 -0
  17. package/dist/convert/to-string-key.mjs +1 -0
  18. package/dist/convert/uint8-array-to-string.cjs +8 -0
  19. package/dist/convert/uint8-array-to-string.d.ts +13 -0
  20. package/dist/convert/uint8-array-to-string.mjs +1 -0
  21. package/dist/convert/utf8-array-to-string.cjs +8 -0
  22. package/dist/convert/utf8-array-to-string.d.ts +13 -0
  23. package/dist/convert/utf8-array-to-string.mjs +1 -0
  24. package/dist/helpers/index.cjs +16 -0
  25. package/dist/helpers/index.d.ts +1 -0
  26. package/dist/helpers/index.mjs +1 -0
  27. package/dist/helpers/parse-type-definition.cjs +33 -0
  28. package/dist/helpers/parse-type-definition.d.ts +8 -0
  29. package/dist/helpers/parse-type-definition.mjs +1 -0
  30. package/dist/index.cjs +49 -0
  31. package/dist/index.d.ts +12 -0
  32. package/dist/index.mjs +1 -0
  33. package/dist/type-checks/get-object-tag.cjs +8 -0
  34. package/dist/type-checks/get-object-tag.d.ts +7 -0
  35. package/dist/type-checks/get-object-tag.mjs +1 -0
  36. package/dist/type-checks/index.cjs +456 -0
  37. package/dist/type-checks/index.d.ts +41 -0
  38. package/dist/type-checks/index.mjs +1 -0
  39. package/dist/type-checks/is-array-like.cjs +11 -0
  40. package/dist/type-checks/is-array-like.d.ts +7 -0
  41. package/dist/type-checks/is-array-like.mjs +1 -0
  42. package/dist/type-checks/is-async-iterable.cjs +10 -0
  43. package/dist/type-checks/is-async-iterable.d.ts +7 -0
  44. package/dist/type-checks/is-async-iterable.mjs +1 -0
  45. package/dist/type-checks/is-bigint.cjs +9 -0
  46. package/dist/type-checks/is-bigint.d.ts +16 -0
  47. package/dist/type-checks/is-bigint.mjs +1 -0
  48. package/dist/type-checks/is-boolean.cjs +14 -0
  49. package/dist/type-checks/is-boolean.d.ts +7 -0
  50. package/dist/type-checks/is-boolean.mjs +1 -0
  51. package/dist/type-checks/is-buffer.cjs +10 -0
  52. package/dist/type-checks/is-buffer.d.ts +5 -0
  53. package/dist/type-checks/is-buffer.mjs +1 -0
  54. package/dist/type-checks/is-collection.cjs +11 -0
  55. package/dist/type-checks/is-collection.d.ts +8 -0
  56. package/dist/type-checks/is-collection.mjs +1 -0
  57. package/dist/type-checks/is-date.cjs +10 -0
  58. package/dist/type-checks/is-date.d.ts +16 -0
  59. package/dist/type-checks/is-date.mjs +1 -0
  60. package/dist/type-checks/is-deep-key.cjs +26 -0
  61. package/dist/type-checks/is-deep-key.d.ts +35 -0
  62. package/dist/type-checks/is-deep-key.mjs +1 -0
  63. package/dist/type-checks/is-empty-object.cjs +23 -0
  64. package/dist/type-checks/is-empty-object.d.ts +14 -0
  65. package/dist/type-checks/is-empty-object.mjs +1 -0
  66. package/dist/type-checks/is-empty-string.cjs +16 -0
  67. package/dist/type-checks/is-empty-string.d.ts +7 -0
  68. package/dist/type-checks/is-empty-string.mjs +1 -0
  69. package/dist/type-checks/is-empty.cjs +35 -0
  70. package/dist/type-checks/is-empty.d.ts +8 -0
  71. package/dist/type-checks/is-empty.mjs +1 -0
  72. package/dist/type-checks/is-equal.cjs +18 -0
  73. package/dist/type-checks/is-equal.d.ts +1 -0
  74. package/dist/type-checks/is-equal.mjs +1 -0
  75. package/dist/type-checks/is-error.cjs +15 -0
  76. package/dist/type-checks/is-error.d.ts +17 -0
  77. package/dist/type-checks/is-error.mjs +1 -0
  78. package/dist/type-checks/is-file-result.cjs +11 -0
  79. package/dist/type-checks/is-file-result.d.ts +8 -0
  80. package/dist/type-checks/is-file-result.mjs +1 -0
  81. package/dist/type-checks/is-float.cjs +9 -0
  82. package/dist/type-checks/is-float.d.ts +8 -0
  83. package/dist/type-checks/is-float.mjs +1 -0
  84. package/dist/type-checks/is-function.cjs +23 -0
  85. package/dist/type-checks/is-function.d.ts +10 -0
  86. package/dist/type-checks/is-function.mjs +1 -0
  87. package/dist/type-checks/is-integer.cjs +10 -0
  88. package/dist/type-checks/is-integer.d.ts +8 -0
  89. package/dist/type-checks/is-integer.mjs +1 -0
  90. package/dist/type-checks/is-mergeable-object.cjs +14 -0
  91. package/dist/type-checks/is-mergeable-object.d.ts +1 -0
  92. package/dist/type-checks/is-mergeable-object.mjs +1 -0
  93. package/dist/type-checks/is-non-null-object.cjs +10 -0
  94. package/dist/type-checks/is-non-null-object.d.ts +7 -0
  95. package/dist/type-checks/is-non-null-object.mjs +1 -0
  96. package/dist/type-checks/is-not-empty.cjs +17 -0
  97. package/dist/type-checks/is-not-empty.d.ts +7 -0
  98. package/dist/type-checks/is-not-empty.mjs +1 -0
  99. package/dist/type-checks/is-null.cjs +14 -0
  100. package/dist/type-checks/is-null.d.ts +1 -0
  101. package/dist/type-checks/is-null.mjs +1 -0
  102. package/dist/type-checks/is-number.cjs +19 -0
  103. package/dist/type-checks/is-number.d.ts +15 -0
  104. package/dist/type-checks/is-number.mjs +1 -0
  105. package/dist/type-checks/is-object-index.cjs +17 -0
  106. package/dist/type-checks/is-object-index.d.ts +7 -0
  107. package/dist/type-checks/is-object-index.mjs +1 -0
  108. package/dist/type-checks/is-object.cjs +30 -0
  109. package/dist/type-checks/is-object.d.ts +30 -0
  110. package/dist/type-checks/is-object.mjs +1 -0
  111. package/dist/type-checks/is-plain-object.cjs +17 -0
  112. package/dist/type-checks/is-plain-object.d.ts +50 -0
  113. package/dist/type-checks/is-plain-object.mjs +1 -0
  114. package/dist/type-checks/is-primitive.cjs +14 -0
  115. package/dist/type-checks/is-primitive.d.ts +1 -0
  116. package/dist/type-checks/is-primitive.mjs +1 -0
  117. package/dist/type-checks/is-promise.cjs +12 -0
  118. package/dist/type-checks/is-promise.d.ts +17 -0
  119. package/dist/type-checks/is-promise.mjs +1 -0
  120. package/dist/type-checks/is-react-element.cjs +8 -0
  121. package/dist/type-checks/is-react-element.d.ts +1 -0
  122. package/dist/type-checks/is-react-element.mjs +1 -0
  123. package/dist/type-checks/is-ref.cjs +14 -0
  124. package/dist/type-checks/is-ref.d.ts +8 -0
  125. package/dist/type-checks/is-ref.mjs +1 -0
  126. package/dist/type-checks/is-regexp.cjs +10 -0
  127. package/dist/type-checks/is-regexp.d.ts +16 -0
  128. package/dist/type-checks/is-regexp.mjs +1 -0
  129. package/dist/type-checks/is-select-option.cjs +15 -0
  130. package/dist/type-checks/is-select-option.d.ts +8 -0
  131. package/dist/type-checks/is-select-option.mjs +1 -0
  132. package/dist/type-checks/is-set-object.cjs +15 -0
  133. package/dist/type-checks/is-set-object.d.ts +7 -0
  134. package/dist/type-checks/is-set-object.mjs +1 -0
  135. package/dist/type-checks/is-set-string.cjs +16 -0
  136. package/dist/type-checks/is-set-string.d.ts +7 -0
  137. package/dist/type-checks/is-set-string.mjs +1 -0
  138. package/dist/type-checks/is-set.cjs +15 -0
  139. package/dist/type-checks/is-set.d.ts +7 -0
  140. package/dist/type-checks/is-set.mjs +1 -0
  141. package/dist/type-checks/is-string.cjs +14 -0
  142. package/dist/type-checks/is-string.d.ts +1 -0
  143. package/dist/type-checks/is-string.mjs +1 -0
  144. package/dist/type-checks/is-symbol.cjs +14 -0
  145. package/dist/type-checks/is-symbol.d.ts +1 -0
  146. package/dist/type-checks/is-symbol.mjs +1 -0
  147. package/dist/type-checks/is-typed-array.cjs +9 -0
  148. package/dist/type-checks/is-typed-array.d.ts +1 -0
  149. package/dist/type-checks/is-typed-array.mjs +1 -0
  150. package/dist/type-checks/is-typed.cjs +16 -0
  151. package/dist/type-checks/is-typed.d.ts +8 -0
  152. package/dist/type-checks/is-typed.mjs +1 -0
  153. package/dist/type-checks/is-undefined.cjs +8 -0
  154. package/dist/type-checks/is-undefined.d.ts +1 -0
  155. package/dist/type-checks/is-undefined.mjs +1 -0
  156. package/dist/type-checks/property-exists.cjs +17 -0
  157. package/dist/type-checks/property-exists.d.ts +16 -0
  158. package/dist/type-checks/property-exists.mjs +1 -0
  159. package/dist/type-checks/type-detect.cjs +38 -0
  160. package/dist/type-checks/type-detect.d.ts +1 -0
  161. package/dist/type-checks/type-detect.mjs +1 -0
  162. package/dist/utility-types/array.cjs +9 -0
  163. package/dist/utility-types/array.d.ts +130 -0
  164. package/dist/utility-types/array.mjs +1 -0
  165. package/dist/utility-types/async.cjs +1 -0
  166. package/dist/utility-types/async.d.ts +103 -0
  167. package/dist/utility-types/async.mjs +0 -0
  168. package/dist/utility-types/base.cjs +16 -0
  169. package/dist/utility-types/base.d.ts +325 -0
  170. package/dist/utility-types/base.mjs +2 -0
  171. package/dist/utility-types/configuration.cjs +1 -0
  172. package/dist/utility-types/configuration.d.ts +59 -0
  173. package/dist/utility-types/configuration.mjs +0 -0
  174. package/dist/utility-types/file.cjs +12 -0
  175. package/dist/utility-types/file.d.ts +29 -0
  176. package/dist/utility-types/file.mjs +1 -0
  177. package/dist/utility-types/form.cjs +1 -0
  178. package/dist/utility-types/form.d.ts +35 -0
  179. package/dist/utility-types/form.mjs +0 -0
  180. package/dist/utility-types/index.cjs +214 -0
  181. package/dist/utility-types/index.d.ts +19 -0
  182. package/dist/utility-types/index.mjs +1 -0
  183. package/dist/utility-types/json.cjs +1 -0
  184. package/dist/utility-types/json.d.ts +82 -0
  185. package/dist/utility-types/json.mjs +0 -0
  186. package/dist/utility-types/logic.cjs +1 -0
  187. package/dist/utility-types/logic.d.ts +152 -0
  188. package/dist/utility-types/logic.mjs +0 -0
  189. package/dist/utility-types/messages.cjs +13 -0
  190. package/dist/utility-types/messages.d.ts +24 -0
  191. package/dist/utility-types/messages.mjs +1 -0
  192. package/dist/utility-types/navigator.cjs +1 -0
  193. package/dist/utility-types/navigator.d.ts +40 -0
  194. package/dist/utility-types/navigator.mjs +0 -0
  195. package/dist/utility-types/number.cjs +1 -0
  196. package/dist/utility-types/number.d.ts +198 -0
  197. package/dist/utility-types/number.mjs +0 -0
  198. package/dist/utility-types/object.cjs +1 -0
  199. package/dist/utility-types/object.d.ts +434 -0
  200. package/dist/utility-types/object.mjs +0 -0
  201. package/dist/utility-types/package-json.cjs +1 -0
  202. package/dist/utility-types/package-json.d.ts +504 -0
  203. package/dist/utility-types/package-json.mjs +0 -0
  204. package/dist/utility-types/package-manager.cjs +18 -0
  205. package/dist/utility-types/package-manager.d.ts +14 -0
  206. package/dist/utility-types/package-manager.mjs +1 -0
  207. package/dist/utility-types/string.cjs +1 -0
  208. package/dist/utility-types/string.d.ts +87 -0
  209. package/dist/utility-types/string.mjs +0 -0
  210. package/dist/utility-types/system.cjs +1 -0
  211. package/dist/utility-types/system.d.ts +1 -0
  212. package/dist/utility-types/system.mjs +0 -0
  213. package/dist/utility-types/tsconfig.cjs +1 -0
  214. package/dist/utility-types/tsconfig.d.ts +800 -0
  215. package/dist/utility-types/tsconfig.mjs +0 -0
  216. package/dist/utility-types/user.cjs +11 -0
  217. package/dist/utility-types/user.d.ts +30 -0
  218. package/dist/utility-types/user.mjs +1 -0
  219. package/dist/utility-types/utilities.cjs +1 -0
  220. package/dist/utility-types/utilities.d.ts +53 -0
  221. package/dist/utility-types/utilities.mjs +0 -0
  222. package/dist/utility-types/validations.cjs +1 -0
  223. package/dist/utility-types/validations.d.ts +16 -0
  224. package/dist/utility-types/validations.mjs +0 -0
  225. package/package.json +1157 -0
@@ -0,0 +1,214 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _array = require("./array.cjs");
7
+ Object.keys(_array).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _array[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _array[key];
14
+ }
15
+ });
16
+ });
17
+ var _async = require("./async.cjs");
18
+ Object.keys(_async).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _async[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function () {
24
+ return _async[key];
25
+ }
26
+ });
27
+ });
28
+ var _base = require("./base.cjs");
29
+ Object.keys(_base).forEach(function (key) {
30
+ if (key === "default" || key === "__esModule") return;
31
+ if (key in exports && exports[key] === _base[key]) return;
32
+ Object.defineProperty(exports, key, {
33
+ enumerable: true,
34
+ get: function () {
35
+ return _base[key];
36
+ }
37
+ });
38
+ });
39
+ var _configuration = require("./configuration.cjs");
40
+ Object.keys(_configuration).forEach(function (key) {
41
+ if (key === "default" || key === "__esModule") return;
42
+ if (key in exports && exports[key] === _configuration[key]) return;
43
+ Object.defineProperty(exports, key, {
44
+ enumerable: true,
45
+ get: function () {
46
+ return _configuration[key];
47
+ }
48
+ });
49
+ });
50
+ var _file = require("./file.cjs");
51
+ Object.keys(_file).forEach(function (key) {
52
+ if (key === "default" || key === "__esModule") return;
53
+ if (key in exports && exports[key] === _file[key]) return;
54
+ Object.defineProperty(exports, key, {
55
+ enumerable: true,
56
+ get: function () {
57
+ return _file[key];
58
+ }
59
+ });
60
+ });
61
+ var _form = require("./form.cjs");
62
+ Object.keys(_form).forEach(function (key) {
63
+ if (key === "default" || key === "__esModule") return;
64
+ if (key in exports && exports[key] === _form[key]) return;
65
+ Object.defineProperty(exports, key, {
66
+ enumerable: true,
67
+ get: function () {
68
+ return _form[key];
69
+ }
70
+ });
71
+ });
72
+ var _json = require("./json.cjs");
73
+ Object.keys(_json).forEach(function (key) {
74
+ if (key === "default" || key === "__esModule") return;
75
+ if (key in exports && exports[key] === _json[key]) return;
76
+ Object.defineProperty(exports, key, {
77
+ enumerable: true,
78
+ get: function () {
79
+ return _json[key];
80
+ }
81
+ });
82
+ });
83
+ var _logic = require("./logic.cjs");
84
+ Object.keys(_logic).forEach(function (key) {
85
+ if (key === "default" || key === "__esModule") return;
86
+ if (key in exports && exports[key] === _logic[key]) return;
87
+ Object.defineProperty(exports, key, {
88
+ enumerable: true,
89
+ get: function () {
90
+ return _logic[key];
91
+ }
92
+ });
93
+ });
94
+ var _messages = require("./messages.cjs");
95
+ Object.keys(_messages).forEach(function (key) {
96
+ if (key === "default" || key === "__esModule") return;
97
+ if (key in exports && exports[key] === _messages[key]) return;
98
+ Object.defineProperty(exports, key, {
99
+ enumerable: true,
100
+ get: function () {
101
+ return _messages[key];
102
+ }
103
+ });
104
+ });
105
+ var _navigator = require("./navigator.cjs");
106
+ Object.keys(_navigator).forEach(function (key) {
107
+ if (key === "default" || key === "__esModule") return;
108
+ if (key in exports && exports[key] === _navigator[key]) return;
109
+ Object.defineProperty(exports, key, {
110
+ enumerable: true,
111
+ get: function () {
112
+ return _navigator[key];
113
+ }
114
+ });
115
+ });
116
+ var _object = require("./object.cjs");
117
+ Object.keys(_object).forEach(function (key) {
118
+ if (key === "default" || key === "__esModule") return;
119
+ if (key in exports && exports[key] === _object[key]) return;
120
+ Object.defineProperty(exports, key, {
121
+ enumerable: true,
122
+ get: function () {
123
+ return _object[key];
124
+ }
125
+ });
126
+ });
127
+ var _packageJson = require("./package-json.cjs");
128
+ Object.keys(_packageJson).forEach(function (key) {
129
+ if (key === "default" || key === "__esModule") return;
130
+ if (key in exports && exports[key] === _packageJson[key]) return;
131
+ Object.defineProperty(exports, key, {
132
+ enumerable: true,
133
+ get: function () {
134
+ return _packageJson[key];
135
+ }
136
+ });
137
+ });
138
+ var _packageManager = require("./package-manager.cjs");
139
+ Object.keys(_packageManager).forEach(function (key) {
140
+ if (key === "default" || key === "__esModule") return;
141
+ if (key in exports && exports[key] === _packageManager[key]) return;
142
+ Object.defineProperty(exports, key, {
143
+ enumerable: true,
144
+ get: function () {
145
+ return _packageManager[key];
146
+ }
147
+ });
148
+ });
149
+ var _string = require("./string.cjs");
150
+ Object.keys(_string).forEach(function (key) {
151
+ if (key === "default" || key === "__esModule") return;
152
+ if (key in exports && exports[key] === _string[key]) return;
153
+ Object.defineProperty(exports, key, {
154
+ enumerable: true,
155
+ get: function () {
156
+ return _string[key];
157
+ }
158
+ });
159
+ });
160
+ var _system = require("./system.cjs");
161
+ Object.keys(_system).forEach(function (key) {
162
+ if (key === "default" || key === "__esModule") return;
163
+ if (key in exports && exports[key] === _system[key]) return;
164
+ Object.defineProperty(exports, key, {
165
+ enumerable: true,
166
+ get: function () {
167
+ return _system[key];
168
+ }
169
+ });
170
+ });
171
+ var _tsconfig = require("./tsconfig.cjs");
172
+ Object.keys(_tsconfig).forEach(function (key) {
173
+ if (key === "default" || key === "__esModule") return;
174
+ if (key in exports && exports[key] === _tsconfig[key]) return;
175
+ Object.defineProperty(exports, key, {
176
+ enumerable: true,
177
+ get: function () {
178
+ return _tsconfig[key];
179
+ }
180
+ });
181
+ });
182
+ var _user = require("./user.cjs");
183
+ Object.keys(_user).forEach(function (key) {
184
+ if (key === "default" || key === "__esModule") return;
185
+ if (key in exports && exports[key] === _user[key]) return;
186
+ Object.defineProperty(exports, key, {
187
+ enumerable: true,
188
+ get: function () {
189
+ return _user[key];
190
+ }
191
+ });
192
+ });
193
+ var _utilities = require("./utilities.cjs");
194
+ Object.keys(_utilities).forEach(function (key) {
195
+ if (key === "default" || key === "__esModule") return;
196
+ if (key in exports && exports[key] === _utilities[key]) return;
197
+ Object.defineProperty(exports, key, {
198
+ enumerable: true,
199
+ get: function () {
200
+ return _utilities[key];
201
+ }
202
+ });
203
+ });
204
+ var _validations = require("./validations.cjs");
205
+ Object.keys(_validations).forEach(function (key) {
206
+ if (key === "default" || key === "__esModule") return;
207
+ if (key in exports && exports[key] === _validations[key]) return;
208
+ Object.defineProperty(exports, key, {
209
+ enumerable: true,
210
+ get: function () {
211
+ return _validations[key];
212
+ }
213
+ });
214
+ });
@@ -0,0 +1,19 @@
1
+ export * from "./array";
2
+ export * from "./async";
3
+ export * from "./base";
4
+ export * from "./configuration";
5
+ export * from "./file";
6
+ export * from "./form";
7
+ export * from "./json";
8
+ export * from "./logic";
9
+ export * from "./messages";
10
+ export * from "./navigator";
11
+ export * from "./object";
12
+ export * from "./package-json";
13
+ export * from "./package-manager";
14
+ export * from "./string";
15
+ export * from "./system";
16
+ export * from "./tsconfig";
17
+ export * from "./user";
18
+ export * from "./utilities";
19
+ export * from "./validations";
@@ -0,0 +1 @@
1
+ export*from"./array";export*from"./async";export*from"./base";export*from"./configuration";export*from"./file";export*from"./form";export*from"./json";export*from"./logic";export*from"./messages";export*from"./navigator";export*from"./object";export*from"./package-json";export*from"./package-manager";export*from"./string";export*from"./system";export*from"./tsconfig";export*from"./user";export*from"./utilities";export*from"./validations";
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,82 @@
1
+ export type JsonObject = {
2
+ [Key in string]: JsonValue;
3
+ } & {
4
+ [Key in string]?: JsonValue | undefined;
5
+ };
6
+ /**
7
+ * Matches a JSON array.
8
+ *
9
+ * @category JSON
10
+ */
11
+ export type JsonArray = JsonValue[] | readonly JsonValue[];
12
+ /**
13
+ * Matches any valid JSON primitive value.
14
+ *
15
+ * @category JSON
16
+ */
17
+ export type JsonPrimitive = string | number | boolean | null;
18
+ /**
19
+ * Matches any valid JSON value.
20
+ *
21
+ * @see `Jsonify` if you need to transform a type to one that is assignable to `JsonValue`.
22
+ *
23
+ * @category JSON
24
+ */
25
+ export type JsonValue = JsonPrimitive | JsonObject | JsonArray;
26
+ /**
27
+ * Matches a JSON pointer's path segments.
28
+ *
29
+ * @remarks
30
+ * These segments are used to navigate through the JSON object structure and point to a specific, referenced value.
31
+ */
32
+ export type JsonPointerPath = (string | number)[];
33
+ /**
34
+ * Create a type with the keys of the given type changed to `string` type.
35
+ *
36
+ * Use-case: Changing interface values to strings in order to use them in a form model.
37
+ *
38
+ * @example
39
+ * ```
40
+ * import type {Stringified} from 'type-fest';
41
+ *
42
+ * type Car = {
43
+ * model: string;
44
+ * speed: number;
45
+ * }
46
+ *
47
+ * const carForm: Stringified<Car> = {
48
+ * model: 'Foo',
49
+ * speed: '101'
50
+ * };
51
+ * ```
52
+ *
53
+ * @category Object
54
+ */
55
+ export type Stringified<ObjectType> = {
56
+ [KeyType in keyof ObjectType]: string;
57
+ };
58
+ /**
59
+ * Get keys of the given type as strings.
60
+ *
61
+ * Number keys are converted to strings.
62
+ *
63
+ * Use-cases:
64
+ * - Get string keys from a type which may have number keys.
65
+ * - Makes it possible to index using strings retrieved from template types.
66
+ *
67
+ * @example
68
+ * ```
69
+ * import type {StringKeyOf} from 'type-fest';
70
+ *
71
+ * type Foo = {
72
+ * 1: number,
73
+ * stringKey: string,
74
+ * };
75
+ *
76
+ * type StringKeysOfFoo = StringKeyOf<Foo>;
77
+ * //=> '1' | 'stringKey'
78
+ * ```
79
+ *
80
+ * @category Object
81
+ */
82
+ export type StringKeyOf<BaseType> = `${Extract<keyof BaseType, string | number>}`;
File without changes
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,152 @@
1
+ import type { BuildTuple, IsEqual } from "./base";
2
+ import type { IsNegative, NegativeInfinity, PositiveInfinity } from "./number";
3
+ import type { StringLength, StringToNumber } from "./string";
4
+ /**
5
+ * Returns a boolean for whether A is false.
6
+ *
7
+ * @example
8
+ * ```
9
+ * Not<true>;
10
+ * //=> false
11
+ *
12
+ * Not<false>;
13
+ * //=> true
14
+ * ```
15
+ */
16
+ export type Not<A extends boolean> = A extends true ? false : A extends false ? true : never;
17
+ /**
18
+ * Returns a boolean for whether the given `boolean` is not `false`.
19
+ */
20
+ export type IsNotFalse<T extends boolean> = [T] extends [false] ? false : true;
21
+ export type Or<A extends boolean, B extends boolean> = [
22
+ A,
23
+ B
24
+ ][number] extends false ? false : true extends [IsEqual<A, true>, IsEqual<B, true>][number] ? true : never;
25
+ export type And<A extends boolean, B extends boolean> = [
26
+ A,
27
+ B
28
+ ][number] extends true ? true : true extends [IsEqual<A, false>, IsEqual<B, false>][number] ? false : never;
29
+ /**
30
+ * Returns a boolean for whether `A` represents a number greater than `B`, where `A` and `B` are both positive numeric characters.
31
+ *
32
+ * @example
33
+ * ```
34
+ * PositiveNumericCharacterGt<'5', '1'>;
35
+ * //=> true
36
+ *
37
+ * PositiveNumericCharacterGt<'1', '1'>;
38
+ * //=> false
39
+ * ```
40
+ */
41
+ export type PositiveNumericCharacterGt<A extends string, B extends string> = NumericString extends `${infer HeadA}${A}${infer _TailA}` ? NumericString extends `${infer HeadB}${B}${infer _TailB}` ? HeadA extends `${HeadB}${infer _}${infer __}` ? true : false : never : never;
42
+ /**
43
+ * Returns a boolean for whether `A` represents a number greater than `B`, where `A` and `B` are both numeric strings and have the same length.
44
+ *
45
+ * @example
46
+ * ```
47
+ * SameLengthPositiveNumericStringGt<'50', '10'>;
48
+ * //=> true
49
+ *
50
+ * SameLengthPositiveNumericStringGt<'10', '10'>;
51
+ * //=> false
52
+ * ```
53
+ */
54
+ export type SameLengthPositiveNumericStringGt<A extends string, B extends string> = A extends `${infer FirstA}${infer RestA}` ? B extends `${infer FirstB}${infer RestB}` ? FirstA extends FirstB ? SameLengthPositiveNumericStringGt<RestA, RestB> : PositiveNumericCharacterGt<FirstA, FirstB> : never : false;
55
+ type NumericString = "0123456789";
56
+ /**
57
+ * Returns a boolean for whether `A` is greater than `B`, where `A` and `B` are both positive numeric strings.
58
+ *
59
+ * @example
60
+ * ```
61
+ * PositiveNumericStringGt<'500', '1'>;
62
+ * //=> true
63
+ *
64
+ * PositiveNumericStringGt<'1', '1'>;
65
+ * //=> false
66
+ *
67
+ * PositiveNumericStringGt<'1', '500'>;
68
+ * //=> false
69
+ * ```
70
+ */
71
+ export type PositiveNumericStringGt<A extends string, B extends string> = A extends B ? false : [
72
+ BuildTuple<StringLength<A>, 0>,
73
+ BuildTuple<StringLength<B>, 0>
74
+ ] extends infer R extends [readonly unknown[], readonly unknown[]] ? R[0] extends [...R[1], ...infer Remain extends readonly unknown[]] ? 0 extends Remain["length"] ? SameLengthPositiveNumericStringGt<A, B> : true : false : never;
75
+ export type LessThan<A extends number, B extends number> = number extends A | B ? never : GreaterThanOrEqual<A, B> extends true ? false : true;
76
+ export type GreaterThan<A extends number, B extends number> = number extends A | B ? never : [
77
+ IsEqual<A, PositiveInfinity>,
78
+ IsEqual<A, NegativeInfinity>,
79
+ IsEqual<B, PositiveInfinity>,
80
+ IsEqual<B, NegativeInfinity>
81
+ ] extends infer R extends [boolean, boolean, boolean, boolean] ? Or<And<IsEqual<R[0], true>, IsEqual<R[2], false>>, And<IsEqual<R[3], true>, IsEqual<R[1], false>>> extends true ? true : Or<And<IsEqual<R[1], true>, IsEqual<R[3], false>>, And<IsEqual<R[2], true>, IsEqual<R[0], false>>> extends true ? false : true extends R[number] ? false : [IsNegative<A>, IsNegative<B>] extends infer R extends [
82
+ boolean,
83
+ boolean
84
+ ] ? [true, false] extends R ? false : [false, true] extends R ? true : [false, false] extends R ? PositiveNumericStringGt<`${A}`, `${B}`> : PositiveNumericStringGt<`${NumberAbsolute<B>}`, `${NumberAbsolute<A>}`> : never : never;
85
+ export type GreaterThanOrEqual<A extends number, B extends number> = number extends A | B ? never : A extends B ? true : GreaterThan<A, B>;
86
+ /**
87
+ * Returns the minimum value from a tuple of integers.
88
+ *
89
+ * Note:
90
+ * - Float numbers are not supported.
91
+ *
92
+ * @example
93
+ * ```
94
+ * ArrayMin<[1, 2, 5, 3]>;
95
+ * //=> 1
96
+ *
97
+ * ArrayMin<[1, 2, 5, 3, -5]>;
98
+ * //=> -5
99
+ * ```
100
+ */
101
+ export type ArrayMin<A extends number[], Result extends number = PositiveInfinity> = number extends A[number] ? never : A extends [infer F extends number, ...infer R extends number[]] ? LessThan<F, Result> extends true ? ArrayMin<R, F> : ArrayMin<R, Result> : Result;
102
+ /**
103
+ * Returns the maximum value from a tuple of integers.
104
+ *
105
+ * Note:
106
+ * - Float numbers are not supported.
107
+ *
108
+ * @example
109
+ * ```
110
+ * ArrayMax<[1, 2, 5, 3]>;
111
+ * //=> 5
112
+ *
113
+ * ArrayMax<[1, 2, 5, 3, 99, -1]>;
114
+ * //=> 99
115
+ * ```
116
+ */
117
+ export type ArrayMax<A extends number[], Result extends number = NegativeInfinity> = number extends A[number] ? never : A extends [infer F extends number, ...infer R extends number[]] ? GreaterThan<F, Result> extends true ? ArrayMax<R, F> : ArrayMax<R, Result> : Result;
118
+ /**
119
+ * Returns the absolute value of a given value.
120
+ *
121
+ * @example
122
+ * ```
123
+ * NumberAbsolute<-1>;
124
+ * //=> 1
125
+ *
126
+ * NumberAbsolute<1>;
127
+ * //=> 1
128
+ *
129
+ * NumberAbsolute<NegativeInfinity>
130
+ * //=> PositiveInfinity
131
+ * ```
132
+ */
133
+ export type NumberAbsolute<N extends number> = `${N}` extends `-${infer StringPositiveN}` ? StringToNumber<StringPositiveN> : N;
134
+ export type Subtract<A extends number, B extends number> = number extends A | B ? number : [
135
+ IsEqual<A, PositiveInfinity>,
136
+ IsEqual<A, NegativeInfinity>,
137
+ IsEqual<B, PositiveInfinity>,
138
+ IsEqual<B, NegativeInfinity>
139
+ ] extends infer R extends [boolean, boolean, boolean, boolean] ? Or<And<IsEqual<R[0], true>, IsEqual<R[2], false>>, And<IsEqual<R[3], true>, IsEqual<R[1], false>>> extends true ? PositiveInfinity : Or<And<IsEqual<R[1], true>, IsEqual<R[3], false>>, And<IsEqual<R[2], true>, IsEqual<R[0], false>>> extends true ? NegativeInfinity : true extends R[number] ? number : [IsNegative<A>, IsNegative<B>] extends infer R ? [false, false] extends R ? BuildTuple<A> extends infer _R ? R extends [...BuildTuple<B>, ...infer R] ? R["length"] : number : never : LessThan<A, B> extends true ? number : [false, true] extends R ? Sum<A, NumberAbsolute<B>> : Subtract<NumberAbsolute<B>, NumberAbsolute<A>> : never : never;
140
+ export type Sum<A extends number, B extends number> = number extends A | B ? number : [
141
+ IsEqual<A, PositiveInfinity>,
142
+ IsEqual<A, NegativeInfinity>,
143
+ IsEqual<B, PositiveInfinity>,
144
+ IsEqual<B, NegativeInfinity>
145
+ ] extends infer R extends [boolean, boolean, boolean, boolean] ? Or<And<IsEqual<R[0], true>, IsEqual<R[3], false>>, And<IsEqual<R[2], true>, IsEqual<R[1], false>>> extends true ? PositiveInfinity : Or<And<IsEqual<R[1], true>, IsEqual<R[2], false>>, And<IsEqual<R[3], true>, IsEqual<R[0], false>>> extends true ? NegativeInfinity : true extends R[number] ? number : ([IsNegative<A>, IsNegative<B>] extends infer R ? [false, false] extends R ? [...BuildTuple<A>, ...BuildTuple<B>]["length"] : [true, true] extends R ? number : ArrayMax<[
146
+ NumberAbsolute<A>,
147
+ NumberAbsolute<B>
148
+ ]> extends infer Max_ ? ArrayMin<[
149
+ NumberAbsolute<A>,
150
+ NumberAbsolute<B>
151
+ ]> extends infer Min_ extends number ? Max_ extends A | B ? Subtract<Max_, Min_> : number : never : never : never) & number : never;
152
+ export {};
File without changes
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.MessageType = void 0;
7
+ const MessageType = exports.MessageType = {
8
+ HELP: "help",
9
+ ERROR: "error",
10
+ WARNING: "warning",
11
+ INFO: "info",
12
+ SUCCESS: "success"
13
+ };
@@ -0,0 +1,24 @@
1
+ export type MessageType = "help" | "error" | "warning" | "info" | "success";
2
+ export declare const MessageType: {
3
+ HELP: MessageType;
4
+ ERROR: MessageType;
5
+ WARNING: MessageType;
6
+ INFO: MessageType;
7
+ SUCCESS: MessageType;
8
+ };
9
+ export type MessageDetails<TMessageType extends typeof MessageType.HELP | typeof MessageType.ERROR | typeof MessageType.WARNING | typeof MessageType.INFO | typeof MessageType.SUCCESS = typeof MessageType.HELP | typeof MessageType.ERROR | typeof MessageType.WARNING | typeof MessageType.INFO | typeof MessageType.SUCCESS> = {
10
+ code: string;
11
+ message?: string;
12
+ type: TMessageType;
13
+ params?: Record<string, any>;
14
+ } | {
15
+ code?: string;
16
+ message: string;
17
+ type: TMessageType;
18
+ params?: Record<string, any>;
19
+ };
20
+ export type HelpMessageDetails = MessageDetails<typeof MessageType.HELP>;
21
+ export type ErrorMessageDetails = MessageDetails<typeof MessageType.ERROR>;
22
+ export type WarningMessageDetails = MessageDetails<typeof MessageType.WARNING>;
23
+ export type InfoMessageDetails = MessageDetails<typeof MessageType.INFO>;
24
+ export type SuccessMessageDetails = MessageDetails<typeof MessageType.SUCCESS>;
@@ -0,0 +1 @@
1
+ export const MessageType={HELP:"help",ERROR:"error",WARNING:"warning",INFO:"info",SUCCESS:"success"};
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,40 @@
1
+ export type BatteryManager = {
2
+ supported: boolean;
3
+ loading: boolean;
4
+ level: number | null;
5
+ charging: boolean | null;
6
+ chargingTime: number | null;
7
+ dischargingTime: number | null;
8
+ addEventListener: (type: string, listener: () => void) => void;
9
+ removeEventListener: (type: string, listener: () => void) => void;
10
+ };
11
+ export type NetworkState = {
12
+ online: boolean;
13
+ downlink: number | null;
14
+ downlinkMax: number | null;
15
+ effectiveType: string | null;
16
+ rtt: number | null;
17
+ saveData: boolean | null;
18
+ type: string | null;
19
+ };
20
+ export declare interface NavigatorNetworkInformation {
21
+ readonly connection?: NetworkInformation;
22
+ }
23
+ export declare interface Navigator extends NavigatorNetworkInformation {
24
+ }
25
+ export declare interface WorkerNavigator extends NavigatorNetworkInformation {
26
+ }
27
+ export type ConnectionType = "bluetooth" | "cellular" | "ethernet" | "mixed" | "none" | "other" | "unknown" | "wifi" | "wimax";
28
+ export type EffectiveConnectionType = "2g" | "3g" | "4g" | "slow-2g";
29
+ type Megabit = number;
30
+ type Millisecond = number;
31
+ export interface NetworkInformation extends EventTarget {
32
+ readonly type?: ConnectionType;
33
+ readonly effectiveType?: EffectiveConnectionType;
34
+ readonly downlinkMax?: Megabit;
35
+ readonly downlink?: Megabit;
36
+ readonly rtt?: Millisecond;
37
+ readonly saveData?: boolean;
38
+ onchange?: EventListener;
39
+ }
40
+ export {};
File without changes
@@ -0,0 +1 @@
1
+ "use strict";