@kensio/smartass 1.7.0 → 1.9.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 (281) hide show
  1. package/dist/assert/array-equals/array-equals.test.d.ts +2 -0
  2. package/dist/assert/array-equals/array-equals.test.d.ts.map +1 -0
  3. package/dist/assert/array-equals/array-equals.test.js +39 -0
  4. package/dist/assert/array-equals/array-equals.test.js.map +1 -0
  5. package/dist/assert/array-includes/array-includes.match.d.ts +5 -3
  6. package/dist/assert/array-includes/array-includes.match.d.ts.map +1 -1
  7. package/dist/assert/array-includes/array-includes.match.js.map +1 -1
  8. package/dist/assert/array-includes/array-includes.test.d.ts +2 -0
  9. package/dist/assert/array-includes/array-includes.test.d.ts.map +1 -0
  10. package/dist/assert/array-includes/array-includes.test.js +79 -0
  11. package/dist/assert/array-includes/array-includes.test.js.map +1 -0
  12. package/dist/assert/array-includes-all/array-includes-all.match.d.ts +5 -6
  13. package/dist/assert/array-includes-all/array-includes-all.match.d.ts.map +1 -1
  14. package/dist/assert/array-includes-all/array-includes-all.match.js.map +1 -1
  15. package/dist/assert/array-includes-all/array-includes-all.test.d.ts +2 -0
  16. package/dist/assert/array-includes-all/array-includes-all.test.d.ts.map +1 -0
  17. package/dist/assert/array-includes-all/array-includes-all.test.js +163 -0
  18. package/dist/assert/array-includes-all/array-includes-all.test.js.map +1 -0
  19. package/dist/assert/array-length/array-length.match.d.ts +7 -2
  20. package/dist/assert/array-length/array-length.match.d.ts.map +1 -1
  21. package/dist/assert/array-length/array-length.match.js +1 -1
  22. package/dist/assert/array-length/array-length.match.js.map +1 -1
  23. package/dist/assert/array-length/array-length.test.d.ts +2 -0
  24. package/dist/assert/array-length/array-length.test.d.ts.map +1 -0
  25. package/dist/assert/array-length/array-length.test.js +104 -0
  26. package/dist/assert/array-length/array-length.test.js.map +1 -0
  27. package/dist/assert/array-min-length/array-min-length.match.d.ts +2 -1
  28. package/dist/assert/array-min-length/array-min-length.match.d.ts.map +1 -1
  29. package/dist/assert/array-min-length/array-min-length.match.js.map +1 -1
  30. package/dist/assert/array-min-length/array-min-length.test.d.ts +2 -0
  31. package/dist/assert/array-min-length/array-min-length.test.d.ts.map +1 -0
  32. package/dist/assert/array-min-length/array-min-length.test.js +115 -0
  33. package/dist/assert/array-min-length/array-min-length.test.js.map +1 -0
  34. package/dist/assert/array-not-empty/array-not-empty.assert.js.map +1 -1
  35. package/dist/assert/array-not-empty/array-not-empty.match.d.ts +2 -1
  36. package/dist/assert/array-not-empty/array-not-empty.match.d.ts.map +1 -1
  37. package/dist/assert/array-not-empty/array-not-empty.match.js +1 -1
  38. package/dist/assert/array-not-empty/array-not-empty.match.js.map +1 -1
  39. package/dist/assert/array-not-empty/array-not-empty.test.d.ts +2 -0
  40. package/dist/assert/array-not-empty/array-not-empty.test.d.ts.map +1 -0
  41. package/dist/assert/array-not-empty/array-not-empty.test.js +76 -0
  42. package/dist/assert/array-not-empty/array-not-empty.test.js.map +1 -0
  43. package/dist/assert/buffer-equal/buffer-equal.assert.d.ts +1 -1
  44. package/dist/assert/buffer-equal/buffer-equal.assert.d.ts.map +1 -1
  45. package/dist/assert/buffer-equal/buffer-equal.assert.js.map +1 -1
  46. package/dist/assert/buffer-equal/buffer-equal.match.d.ts +1 -1
  47. package/dist/assert/buffer-equal/buffer-equal.match.d.ts.map +1 -1
  48. package/dist/assert/buffer-equal/buffer-equal.match.js +1 -1
  49. package/dist/assert/buffer-equal/buffer-equal.match.js.map +1 -1
  50. package/dist/assert/buffer-equal/buffer-equal.test.d.ts +2 -0
  51. package/dist/assert/buffer-equal/buffer-equal.test.d.ts.map +1 -0
  52. package/dist/assert/buffer-equal/buffer-equal.test.js +170 -0
  53. package/dist/assert/buffer-equal/buffer-equal.test.js.map +1 -0
  54. package/dist/assert/false/false.test.d.ts +2 -0
  55. package/dist/assert/false/false.test.d.ts.map +1 -0
  56. package/dist/assert/false/false.test.js +45 -0
  57. package/dist/assert/false/false.test.js.map +1 -0
  58. package/dist/assert/identical/identical.test.d.ts +2 -0
  59. package/dist/assert/identical/identical.test.d.ts.map +1 -0
  60. package/dist/assert/identical/identical.test.js +61 -0
  61. package/dist/assert/identical/identical.test.js.map +1 -0
  62. package/dist/assert/instance-of/instance-of.assert.d.ts +2 -1
  63. package/dist/assert/instance-of/instance-of.assert.d.ts.map +1 -1
  64. package/dist/assert/instance-of/instance-of.assert.js.map +1 -1
  65. package/dist/assert/instance-of/instance-of.match.d.ts +2 -1
  66. package/dist/assert/instance-of/instance-of.match.d.ts.map +1 -1
  67. package/dist/assert/instance-of/instance-of.match.js.map +1 -1
  68. package/dist/assert/instance-of/instance-of.test.d.ts +2 -0
  69. package/dist/assert/instance-of/instance-of.test.d.ts.map +1 -0
  70. package/dist/assert/instance-of/instance-of.test.js +112 -0
  71. package/dist/assert/instance-of/instance-of.test.js.map +1 -0
  72. package/dist/assert/non-nullable/non-nullable.test.d.ts +2 -0
  73. package/dist/assert/non-nullable/non-nullable.test.d.ts.map +1 -0
  74. package/dist/assert/non-nullable/non-nullable.test.js +64 -0
  75. package/dist/assert/non-nullable/non-nullable.test.js.map +1 -0
  76. package/dist/assert/number-between/number-between.test.d.ts +2 -0
  77. package/dist/assert/number-between/number-between.test.d.ts.map +1 -0
  78. package/dist/assert/number-between/number-between.test.js +185 -0
  79. package/dist/assert/number-between/number-between.test.js.map +1 -0
  80. package/dist/assert/number-to-nearest/number-to-nearest.test.d.ts +2 -0
  81. package/dist/assert/number-to-nearest/number-to-nearest.test.d.ts.map +1 -0
  82. package/dist/assert/number-to-nearest/number-to-nearest.test.js +129 -0
  83. package/dist/assert/number-to-nearest/number-to-nearest.test.js.map +1 -0
  84. package/dist/assert/object-equals/object-equals.test.d.ts +2 -0
  85. package/dist/assert/object-equals/object-equals.test.d.ts.map +1 -0
  86. package/dist/assert/object-equals/object-equals.test.js +87 -0
  87. package/dist/assert/object-equals/object-equals.test.js.map +1 -0
  88. package/dist/assert/object-has-property/object-has-property.assert.d.ts +1 -1
  89. package/dist/assert/object-has-property/object-has-property.assert.d.ts.map +1 -1
  90. package/dist/assert/object-has-property/object-has-property.match.d.ts +8 -3
  91. package/dist/assert/object-has-property/object-has-property.match.d.ts.map +1 -1
  92. package/dist/assert/object-has-property/object-has-property.match.js +1 -1
  93. package/dist/assert/object-has-property/object-has-property.match.js.map +1 -1
  94. package/dist/assert/object-has-property/object-has-property.test.d.ts +2 -0
  95. package/dist/assert/object-has-property/object-has-property.test.d.ts.map +1 -0
  96. package/dist/assert/object-has-property/object-has-property.test.js +123 -0
  97. package/dist/assert/object-has-property/object-has-property.test.js.map +1 -0
  98. package/dist/assert/object-matches/object-matches.assert.d.ts +26 -7
  99. package/dist/assert/object-matches/object-matches.assert.d.ts.map +1 -1
  100. package/dist/assert/object-matches/object-matches.assert.js.map +1 -1
  101. package/dist/assert/object-matches/object-matches.test.d.ts +2 -0
  102. package/dist/assert/object-matches/object-matches.test.d.ts.map +1 -0
  103. package/dist/assert/object-matches/object-matches.test.js +134 -0
  104. package/dist/assert/object-matches/object-matches.test.js.map +1 -0
  105. package/dist/assert/one-of/one-of.test.d.ts +2 -0
  106. package/dist/assert/one-of/one-of.test.d.ts.map +1 -0
  107. package/dist/assert/one-of/one-of.test.js +122 -0
  108. package/dist/assert/one-of/one-of.test.js.map +1 -0
  109. package/dist/assert/string-ends-with/string-ends-with.match.js +1 -1
  110. package/dist/assert/string-ends-with/string-ends-with.test.d.ts +2 -0
  111. package/dist/assert/string-ends-with/string-ends-with.test.d.ts.map +1 -0
  112. package/dist/assert/string-ends-with/string-ends-with.test.js +104 -0
  113. package/dist/assert/string-ends-with/string-ends-with.test.js.map +1 -0
  114. package/dist/assert/string-includes/string-includes.test.d.ts +2 -0
  115. package/dist/assert/string-includes/string-includes.test.d.ts.map +1 -0
  116. package/dist/assert/string-includes/string-includes.test.js +115 -0
  117. package/dist/assert/string-includes/string-includes.test.js.map +1 -0
  118. package/dist/assert/string-length/string-length.match.d.ts +5 -2
  119. package/dist/assert/string-length/string-length.match.d.ts.map +1 -1
  120. package/dist/assert/string-length/string-length.match.js +1 -1
  121. package/dist/assert/string-length/string-length.match.js.map +1 -1
  122. package/dist/assert/string-length/string-length.test.d.ts +2 -0
  123. package/dist/assert/string-length/string-length.test.d.ts.map +1 -0
  124. package/dist/assert/string-length/string-length.test.js +151 -0
  125. package/dist/assert/string-length/string-length.test.js.map +1 -0
  126. package/dist/assert/string-not-includes/string-not-includes.test.d.ts +2 -0
  127. package/dist/assert/string-not-includes/string-not-includes.test.d.ts.map +1 -0
  128. package/dist/assert/string-not-includes/string-not-includes.test.js +124 -0
  129. package/dist/assert/string-not-includes/string-not-includes.test.js.map +1 -0
  130. package/dist/assert/string-starts-with/string-starts-with.assert.d.ts.map +1 -1
  131. package/dist/assert/string-starts-with/string-starts-with.assert.js +4 -2
  132. package/dist/assert/string-starts-with/string-starts-with.assert.js.map +1 -1
  133. package/dist/assert/string-starts-with/string-starts-with.match.d.ts +6 -0
  134. package/dist/assert/string-starts-with/string-starts-with.match.d.ts.map +1 -0
  135. package/dist/assert/string-starts-with/string-starts-with.match.js +9 -0
  136. package/dist/assert/string-starts-with/string-starts-with.match.js.map +1 -0
  137. package/dist/assert/string-starts-with/string-starts-with.test.d.ts +2 -0
  138. package/dist/assert/string-starts-with/string-starts-with.test.d.ts.map +1 -0
  139. package/dist/assert/string-starts-with/string-starts-with.test.js +90 -0
  140. package/dist/assert/string-starts-with/string-starts-with.test.js.map +1 -0
  141. package/dist/assert/throws-error/throws-error.test.d.ts +2 -0
  142. package/dist/assert/throws-error/throws-error.test.d.ts.map +1 -0
  143. package/dist/assert/throws-error/throws-error.test.js +74 -0
  144. package/dist/assert/throws-error/throws-error.test.js.map +1 -0
  145. package/dist/assert/throws-error-async/throws-error-async.test.d.ts +2 -0
  146. package/dist/assert/throws-error-async/throws-error-async.test.d.ts.map +1 -0
  147. package/dist/assert/throws-error-async/throws-error-async.test.js +61 -0
  148. package/dist/assert/throws-error-async/throws-error-async.test.js.map +1 -0
  149. package/dist/assert/throws-error-like/throws-error-like.test.d.ts +2 -0
  150. package/dist/assert/throws-error-like/throws-error-like.test.d.ts.map +1 -0
  151. package/dist/assert/throws-error-like/throws-error-like.test.js +151 -0
  152. package/dist/assert/throws-error-like/throws-error-like.test.js.map +1 -0
  153. package/dist/assert/true/true.test.d.ts +2 -0
  154. package/dist/assert/true/true.test.d.ts.map +1 -0
  155. package/dist/assert/true/true.test.js +45 -0
  156. package/dist/assert/true/true.test.js.map +1 -0
  157. package/dist/assert/type-bigint/type-bigint.assert.d.ts.map +1 -1
  158. package/dist/assert/type-bigint/type-bigint.assert.js +4 -2
  159. package/dist/assert/type-bigint/type-bigint.assert.js.map +1 -1
  160. package/dist/assert/type-bigint/type-bigint.match.d.ts +6 -0
  161. package/dist/assert/type-bigint/type-bigint.match.d.ts.map +1 -0
  162. package/dist/assert/type-bigint/type-bigint.match.js +8 -0
  163. package/dist/assert/type-bigint/type-bigint.match.js.map +1 -0
  164. package/dist/assert/type-bigint/type-bigint.test.d.ts +2 -0
  165. package/dist/assert/type-bigint/type-bigint.test.d.ts.map +1 -0
  166. package/dist/assert/type-bigint/type-bigint.test.js +83 -0
  167. package/dist/assert/type-bigint/type-bigint.test.js.map +1 -0
  168. package/dist/assert/type-boolean/type-boolean.assert.d.ts.map +1 -1
  169. package/dist/assert/type-boolean/type-boolean.assert.js +4 -2
  170. package/dist/assert/type-boolean/type-boolean.assert.js.map +1 -1
  171. package/dist/assert/type-boolean/type-boolean.match.d.ts +6 -0
  172. package/dist/assert/type-boolean/type-boolean.match.d.ts.map +1 -0
  173. package/dist/assert/type-boolean/type-boolean.match.js +8 -0
  174. package/dist/assert/type-boolean/type-boolean.match.js.map +1 -0
  175. package/dist/assert/type-boolean/type-boolean.test.d.ts +2 -0
  176. package/dist/assert/type-boolean/type-boolean.test.d.ts.map +1 -0
  177. package/dist/assert/type-boolean/type-boolean.test.js +64 -0
  178. package/dist/assert/type-boolean/type-boolean.test.js.map +1 -0
  179. package/dist/assert/type-function/type-function.assert.d.ts.map +1 -1
  180. package/dist/assert/type-function/type-function.assert.js +4 -2
  181. package/dist/assert/type-function/type-function.assert.js.map +1 -1
  182. package/dist/assert/type-function/type-function.match.d.ts +6 -0
  183. package/dist/assert/type-function/type-function.match.d.ts.map +1 -0
  184. package/dist/assert/type-function/type-function.match.js +11 -0
  185. package/dist/assert/type-function/type-function.match.js.map +1 -0
  186. package/dist/assert/type-function/type-function.test.d.ts +2 -0
  187. package/dist/assert/type-function/type-function.test.d.ts.map +1 -0
  188. package/dist/assert/type-function/type-function.test.js +84 -0
  189. package/dist/assert/type-function/type-function.test.js.map +1 -0
  190. package/dist/assert/type-number/type-number.assert.d.ts.map +1 -1
  191. package/dist/assert/type-number/type-number.assert.js +4 -2
  192. package/dist/assert/type-number/type-number.assert.js.map +1 -1
  193. package/dist/assert/type-number/type-number.match.d.ts +6 -0
  194. package/dist/assert/type-number/type-number.match.d.ts.map +1 -0
  195. package/dist/assert/type-number/type-number.match.js +8 -0
  196. package/dist/assert/type-number/type-number.match.js.map +1 -0
  197. package/dist/assert/type-number/type-number.test.d.ts +2 -0
  198. package/dist/assert/type-number/type-number.test.d.ts.map +1 -0
  199. package/dist/assert/type-number/type-number.test.js +82 -0
  200. package/dist/assert/type-number/type-number.test.js.map +1 -0
  201. package/dist/assert/type-numeric/type-numeric.assert.d.ts.map +1 -1
  202. package/dist/assert/type-numeric/type-numeric.assert.js +4 -2
  203. package/dist/assert/type-numeric/type-numeric.assert.js.map +1 -1
  204. package/dist/assert/type-numeric/type-numeric.match.d.ts +6 -0
  205. package/dist/assert/type-numeric/type-numeric.match.d.ts.map +1 -0
  206. package/dist/assert/type-numeric/type-numeric.match.js +8 -0
  207. package/dist/assert/type-numeric/type-numeric.match.js.map +1 -0
  208. package/dist/assert/type-numeric/type-numeric.test.d.ts +2 -0
  209. package/dist/assert/type-numeric/type-numeric.test.d.ts.map +1 -0
  210. package/dist/assert/type-numeric/type-numeric.test.js +96 -0
  211. package/dist/assert/type-numeric/type-numeric.test.js.map +1 -0
  212. package/dist/assert/type-object/type-object.assert.d.ts.map +1 -1
  213. package/dist/assert/type-object/type-object.assert.js +4 -2
  214. package/dist/assert/type-object/type-object.assert.js.map +1 -1
  215. package/dist/assert/type-object/type-object.match.d.ts +6 -0
  216. package/dist/assert/type-object/type-object.match.d.ts.map +1 -0
  217. package/dist/assert/type-object/type-object.match.js +8 -0
  218. package/dist/assert/type-object/type-object.match.js.map +1 -0
  219. package/dist/assert/type-object/type-object.test.d.ts +2 -0
  220. package/dist/assert/type-object/type-object.test.d.ts.map +1 -0
  221. package/dist/assert/type-object/type-object.test.js +71 -0
  222. package/dist/assert/type-object/type-object.test.js.map +1 -0
  223. package/dist/assert/type-string/type-string.assert.d.ts.map +1 -1
  224. package/dist/assert/type-string/type-string.assert.js +4 -2
  225. package/dist/assert/type-string/type-string.assert.js.map +1 -1
  226. package/dist/assert/type-string/type-string.match.d.ts +6 -0
  227. package/dist/assert/type-string/type-string.match.d.ts.map +1 -0
  228. package/dist/assert/type-string/type-string.match.js +8 -0
  229. package/dist/assert/type-string/type-string.match.js.map +1 -0
  230. package/dist/assert/type-string/type-string.test.d.ts +2 -0
  231. package/dist/assert/type-string/type-string.test.d.ts.map +1 -0
  232. package/dist/assert/type-string/type-string.test.js +62 -0
  233. package/dist/assert/type-string/type-string.test.js.map +1 -0
  234. package/dist/assert/type-typed-array/type-typed-array.assert.d.ts +1 -4
  235. package/dist/assert/type-typed-array/type-typed-array.assert.d.ts.map +1 -1
  236. package/dist/assert/type-typed-array/type-typed-array.assert.js +4 -2
  237. package/dist/assert/type-typed-array/type-typed-array.assert.js.map +1 -1
  238. package/dist/assert/type-typed-array/type-typed-array.match.d.ts +10 -0
  239. package/dist/assert/type-typed-array/type-typed-array.match.d.ts.map +1 -0
  240. package/dist/assert/type-typed-array/type-typed-array.match.js +8 -0
  241. package/dist/assert/type-typed-array/type-typed-array.match.js.map +1 -0
  242. package/dist/assert/type-typed-array/type-typed-array.test.d.ts +2 -0
  243. package/dist/assert/type-typed-array/type-typed-array.test.d.ts.map +1 -0
  244. package/dist/assert/type-typed-array/type-typed-array.test.js +173 -0
  245. package/dist/assert/type-typed-array/type-typed-array.test.js.map +1 -0
  246. package/dist/assert/typeof/typeof.test.d.ts +2 -0
  247. package/dist/assert/typeof/typeof.test.d.ts.map +1 -0
  248. package/dist/assert/typeof/typeof.test.js +61 -0
  249. package/dist/assert/typeof/typeof.test.js.map +1 -0
  250. package/dist/assert/undefined/undefined.test.d.ts +2 -0
  251. package/dist/assert/undefined/undefined.test.d.ts.map +1 -0
  252. package/dist/assert/undefined/undefined.test.js +45 -0
  253. package/dist/assert/undefined/undefined.test.js.map +1 -0
  254. package/dist/assert/uuid/uuid-v4.assert.d.ts +1 -3
  255. package/dist/assert/uuid/uuid-v4.assert.d.ts.map +1 -1
  256. package/dist/assert/uuid/uuid-v4.assert.js +4 -3
  257. package/dist/assert/uuid/uuid-v4.assert.js.map +1 -1
  258. package/dist/assert/uuid/uuid-v4.match.d.ts +8 -0
  259. package/dist/assert/uuid/uuid-v4.match.d.ts.map +1 -0
  260. package/dist/assert/uuid/uuid-v4.match.js +9 -0
  261. package/dist/assert/uuid/uuid-v4.match.js.map +1 -0
  262. package/dist/assert/uuid/uuid-v4.test.d.ts +2 -0
  263. package/dist/assert/uuid/uuid-v4.test.d.ts.map +1 -0
  264. package/dist/assert/uuid/uuid-v4.test.js +81 -0
  265. package/dist/assert/uuid/uuid-v4.test.js.map +1 -0
  266. package/dist/assertion-error.d.ts +0 -1
  267. package/dist/assertion-error.d.ts.map +1 -1
  268. package/dist/assertion-error.js +0 -1
  269. package/dist/assertion-error.js.map +1 -1
  270. package/dist/describe/describe.test.d.ts +2 -0
  271. package/dist/describe/describe.test.d.ts.map +1 -0
  272. package/dist/describe/describe.test.js +313 -0
  273. package/dist/describe/describe.test.js.map +1 -0
  274. package/dist/index.d.ts +16 -0
  275. package/dist/index.d.ts.map +1 -1
  276. package/dist/index.js +16 -0
  277. package/dist/index.js.map +1 -1
  278. package/dist/match/match.d.ts +5 -0
  279. package/dist/match/match.d.ts.map +1 -1
  280. package/dist/match/match.js.map +1 -1
  281. package/package.json +8 -5
@@ -0,0 +1 @@
1
+ {"version":3,"file":"throws-error-like.test.js","sourceRoot":"","sources":["../../../src/assert/throws-error-like/throws-error-like.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,MAAM,SAAS,CAAC;AAEzB,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IACjC,EAAE,CAAC,iDAAiD,EAAE,GAAG,EAAE;QACzD,MAAM,SAAS,GAAG,qBAAqB,CAAC,GAAG,EAAE;YAC3C,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;QAChC,CAAC,CAAC,CAAC;QACH,MAAM,CAAC,SAAS,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;QACxC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,wEAAwE,EAAE,GAAG,EAAE;QAChF,MAAM,SAAS,GAAG,qBAAqB,CAAC,GAAG,EAAE;YAC3C,+DAA+D;YAC/D,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC;QACzD,CAAC,CAAC,CAAC;QACH,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC3C,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;IAE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@@
1
+ {"version":3,"file":"true.test.d.ts","sourceRoot":"","sources":["../../../src/assert/true/true.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,45 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { assertTrue } from "./true.assert.js";
3
+ describe("assertTrue", () => {
4
+ it("should pass when value is true", () => {
5
+ expect(() => {
6
+ assertTrue(true);
7
+ }).not.toThrow();
8
+ });
9
+ it("should fail when value is false", () => {
10
+ expect(() => {
11
+ assertTrue(false);
12
+ }).toThrow("Expected boolean false to be boolean true.");
13
+ });
14
+ it("should fail when value is truthy but not true", () => {
15
+ expect(() => {
16
+ assertTrue(1);
17
+ }).toThrow("Expected number 1 to be boolean true.");
18
+ expect(() => {
19
+ assertTrue("true");
20
+ }).toThrow('Expected string "true" to be boolean true.');
21
+ expect(() => {
22
+ assertTrue({});
23
+ }).toThrow("Expected object {} to be boolean true.");
24
+ });
25
+ it("should fail when value is falsy", () => {
26
+ expect(() => {
27
+ assertTrue(0);
28
+ }).toThrow("Expected number 0 to be boolean true.");
29
+ expect(() => {
30
+ assertTrue("");
31
+ }).toThrow('Expected string "" to be boolean true.');
32
+ expect(() => {
33
+ assertTrue(null);
34
+ }).toThrow("Expected null to be boolean true.");
35
+ expect(() => {
36
+ assertTrue(undefined);
37
+ }).toThrow("Expected undefined to be boolean true.");
38
+ });
39
+ it("should accept custom message", () => {
40
+ expect(() => {
41
+ assertTrue(false, "Custom error message");
42
+ }).toThrow("Custom error message");
43
+ });
44
+ });
45
+ //# sourceMappingURL=true.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"true.test.js","sourceRoot":"","sources":["../../../src/assert/true/true.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;IAC1B,EAAE,CAAC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E;YACV,UAAU,CAAC,SAAS,CAAC,CAAC;QACxB,CAAC,CAAC,CAAC,OAAO,CAAC,wCAAwC,CAAC,CAAC;IACvD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8BAA8B,EAAE,GAAG,EAAE;QACtC,MAAM,CAAC,GAAG,EAAE;YACV,UAAU,CAAC,KAAK,EAAE,sBAAsB,CAAC,CAAC;QAC5C,CAAC,CAAC,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"type-bigint.assert.d.ts","sourceRoot":"","sources":["../../../src/assert/type-bigint/type-bigint.assert.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,OAAO,EACd,OAAO,SAAkD,GACxD,OAAO,CAAC,KAAK,IAAI,MAAM,CAIzB"}
1
+ {"version":3,"file":"type-bigint.assert.d.ts","sourceRoot":"","sources":["../../../src/assert/type-bigint/type-bigint.assert.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,OAAO,EACd,OAAO,SAAkD,GACxD,OAAO,CAAC,KAAK,IAAI,MAAM,CAKzB"}
@@ -1,11 +1,13 @@
1
1
  import { AssertionError } from "../../assertion-error.js";
2
2
  import { desc } from "../../describe/describe.js";
3
+ import { typeBigInt } from "./type-bigint.match.js";
3
4
  /**
4
5
  * Asserts that a value is a bigint, with type-narrowing.
5
6
  */
6
7
  export function assertTypeBigInt(value, message = `Expected ${desc(value)} to be of type bigint.`) {
7
- if (typeof value !== "bigint") {
8
- throw new AssertionError(message, typeof value, "bigint");
8
+ const matcher = typeBigInt();
9
+ if (!matcher.matches(value)) {
10
+ throw new AssertionError(message, value, matcher.represent());
9
11
  }
10
12
  }
11
13
  //# sourceMappingURL=type-bigint.assert.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"type-bigint.assert.js","sourceRoot":"","sources":["../../../src/assert/type-bigint/type-bigint.assert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAElD;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAC9B,KAAc,EACd,OAAO,GAAG,YAAY,IAAI,CAAC,KAAK,CAAC,wBAAwB;IAEzD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,IAAI,cAAc,CAAC,OAAO,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC5D,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"type-bigint.assert.js","sourceRoot":"","sources":["../../../src/assert/type-bigint/type-bigint.assert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAC9B,KAAc,EACd,OAAO,GAAG,YAAY,IAAI,CAAC,KAAK,CAAC,wBAAwB;IAEzD,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,cAAc,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;IAChE,CAAC;AACH,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { type AssertionMatcher } from "../../match/match.js";
2
+ /**
3
+ * Matcher for a bigint value.
4
+ */
5
+ export declare function typeBigInt(): AssertionMatcher<bigint>;
6
+ //# sourceMappingURL=type-bigint.match.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-bigint.match.d.ts","sourceRoot":"","sources":["../../../src/assert/type-bigint/type-bigint.match.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAiB,MAAM,sBAAsB,CAAC;AAE5E;;GAEG;AACH,wBAAgB,UAAU,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAMrD"}
@@ -0,0 +1,8 @@
1
+ import { createMatcher } from "../../match/match.js";
2
+ /**
3
+ * Matcher for a bigint value.
4
+ */
5
+ export function typeBigInt() {
6
+ return createMatcher((value) => typeof value === "bigint", () => "bigint", () => "BigInt()");
7
+ }
8
+ //# sourceMappingURL=type-bigint.match.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-bigint.match.js","sourceRoot":"","sources":["../../../src/assert/type-bigint/type-bigint.match.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE5E;;GAEG;AACH,MAAM,UAAU,UAAU;IACxB,OAAO,aAAa,CAClB,CAAC,KAAK,EAAmB,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,EACrD,GAAG,EAAE,CAAC,QAAQ,EACd,GAAG,EAAE,CAAC,UAAU,CACjB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=type-bigint.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-bigint.test.d.ts","sourceRoot":"","sources":["../../../src/assert/type-bigint/type-bigint.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,83 @@
1
+ import { describe, it, expect } from "vitest";
2
+ import { assertTypeBigInt } from "./type-bigint.assert.js";
3
+ import { AssertionError } from "../../assertion-error.js";
4
+ import { desc, repr } from "../../describe/describe.js";
5
+ import { typeBigInt } from "./type-bigint.match.js";
6
+ describe("type-bigint", () => {
7
+ describe("assertTypeBigInt", () => {
8
+ it("should pass for bigint values", () => {
9
+ expect(() => {
10
+ assertTypeBigInt(0n);
11
+ }).not.toThrow();
12
+ expect(() => {
13
+ assertTypeBigInt(42n);
14
+ }).not.toThrow();
15
+ expect(() => {
16
+ assertTypeBigInt(-42n);
17
+ }).not.toThrow();
18
+ expect(() => {
19
+ assertTypeBigInt(100n);
20
+ }).not.toThrow();
21
+ });
22
+ it("should throw AssertionError for non-bigint values", () => {
23
+ expect(() => {
24
+ assertTypeBigInt(42);
25
+ }).toThrow(AssertionError);
26
+ expect(() => {
27
+ assertTypeBigInt("42");
28
+ }).toThrow(AssertionError);
29
+ expect(() => {
30
+ assertTypeBigInt(null);
31
+ }).toThrow(AssertionError);
32
+ expect(() => {
33
+ assertTypeBigInt(undefined);
34
+ }).toThrow(AssertionError);
35
+ expect(() => {
36
+ assertTypeBigInt({});
37
+ }).toThrow(AssertionError);
38
+ expect(() => {
39
+ assertTypeBigInt([]);
40
+ }).toThrow(AssertionError);
41
+ expect(() => {
42
+ assertTypeBigInt(true);
43
+ }).toThrow(AssertionError);
44
+ });
45
+ it("should throw with default error message", () => {
46
+ expect(() => {
47
+ assertTypeBigInt(42);
48
+ }).toThrow("Expected number 42 to be of type bigint.");
49
+ });
50
+ it("should throw with custom error message", () => {
51
+ expect(() => {
52
+ assertTypeBigInt(42, "Custom error");
53
+ }).toThrow("Custom error");
54
+ });
55
+ });
56
+ describe("typeBigInt", () => {
57
+ it("matches bigint values", () => {
58
+ const matcher = typeBigInt();
59
+ expect(matcher.matches(0n)).toBe(true);
60
+ expect(matcher.matches(42n)).toBe(true);
61
+ expect(matcher.matches(-42n)).toBe(true);
62
+ });
63
+ it("does not match non-bigint values", () => {
64
+ const matcher = typeBigInt();
65
+ expect(matcher.matches(42)).toBe(false);
66
+ expect(matcher.matches("42")).toBe(false);
67
+ expect(matcher.matches(null)).toBe(false);
68
+ expect(matcher.matches(undefined)).toBe(false);
69
+ expect(matcher.matches({})).toBe(false);
70
+ expect(matcher.matches([])).toBe(false);
71
+ expect(matcher.matches(true)).toBe(false);
72
+ });
73
+ it("describes the matcher", () => {
74
+ const matcher = typeBigInt();
75
+ expect(desc(matcher)).toBe("bigint");
76
+ });
77
+ it("represents the matcher", () => {
78
+ const matcher = typeBigInt();
79
+ expect(repr(matcher)).toBe("BigInt()");
80
+ });
81
+ });
82
+ });
83
+ //# sourceMappingURL=type-bigint.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-bigint.test.js","sourceRoot":"","sources":["../../../src/assert/type-bigint/type-bigint.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAC3B,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;QAChC,EAAE,CAAC,+BAA+B,EAAE,GAAG,EAAE;YACvC,MAAM,CAAC,GAAG,EAAE;gBACV,gBAAgB,CAAC,EAAE,CAAC,CAAC;YACvB,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;YACjB,MAAM,CAAC,GAAG,EAAE;gBACV,gBAAgB,CAAC,GAAG,CAAC,CAAC;YACxB,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;YACjB,MAAM,CAAC,GAAG,EAAE;gBACV,gBAAgB,CAAC,CAAC,GAAG,CAAC,CAAC;YACzB,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;YACjB,MAAM,CAAC,GAAG,EAAE;gBACV,gBAAgB,CAAC,IAAI,CAAC,CAAC;YACzB,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;QACnB,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,mDAA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C,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC5C,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,uBAAuB,EAAE,GAAG,EAAE;YAC/B,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;YAC7B,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,wBAAwB,EAAE,GAAG,EAAE;YAChC,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;YAC7B,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACzC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"type-boolean.assert.d.ts","sourceRoot":"","sources":["../../../src/assert/type-boolean/type-boolean.assert.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,OAAO,EACd,OAAO,SAAmD,GACzD,OAAO,CAAC,KAAK,IAAI,OAAO,CAI1B"}
1
+ {"version":3,"file":"type-boolean.assert.d.ts","sourceRoot":"","sources":["../../../src/assert/type-boolean/type-boolean.assert.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,OAAO,EACd,OAAO,SAAmD,GACzD,OAAO,CAAC,KAAK,IAAI,OAAO,CAK1B"}
@@ -1,11 +1,13 @@
1
1
  import { AssertionError } from "../../assertion-error.js";
2
2
  import { desc } from "../../describe/describe.js";
3
+ import { typeBoolean } from "./type-boolean.match.js";
3
4
  /**
4
5
  * Assert that a value is of type boolean, with type-narrowing.
5
6
  */
6
7
  export function assertTypeBoolean(value, message = `Expected ${desc(value)} to be of type boolean.`) {
7
- if (typeof value !== "boolean") {
8
- throw new AssertionError(message, typeof value, "boolean");
8
+ const matcher = typeBoolean();
9
+ if (!matcher.matches(value)) {
10
+ throw new AssertionError(message, value, matcher.represent());
9
11
  }
10
12
  }
11
13
  //# sourceMappingURL=type-boolean.assert.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"type-boolean.assert.js","sourceRoot":"","sources":["../../../src/assert/type-boolean/type-boolean.assert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAElD;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAC/B,KAAc,EACd,OAAO,GAAG,YAAY,IAAI,CAAC,KAAK,CAAC,yBAAyB;IAE1D,IAAI,OAAO,KAAK,KAAK,SAAS,EAAE,CAAC;QAC/B,MAAM,IAAI,cAAc,CAAC,OAAO,EAAE,OAAO,KAAK,EAAE,SAAS,CAAC,CAAC;IAC7D,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"type-boolean.assert.js","sourceRoot":"","sources":["../../../src/assert/type-boolean/type-boolean.assert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAC/B,KAAc,EACd,OAAO,GAAG,YAAY,IAAI,CAAC,KAAK,CAAC,yBAAyB;IAE1D,MAAM,OAAO,GAAG,WAAW,EAAE,CAAC;IAC9B,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,cAAc,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;IAChE,CAAC;AACH,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { type AssertionMatcher } from "../../match/match.js";
2
+ /**
3
+ * Matcher for a boolean value.
4
+ */
5
+ export declare function typeBoolean(): AssertionMatcher<boolean>;
6
+ //# sourceMappingURL=type-boolean.match.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-boolean.match.d.ts","sourceRoot":"","sources":["../../../src/assert/type-boolean/type-boolean.match.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAiB,MAAM,sBAAsB,CAAC;AAE5E;;GAEG;AACH,wBAAgB,WAAW,IAAI,gBAAgB,CAAC,OAAO,CAAC,CAMvD"}
@@ -0,0 +1,8 @@
1
+ import { createMatcher } from "../../match/match.js";
2
+ /**
3
+ * Matcher for a boolean value.
4
+ */
5
+ export function typeBoolean() {
6
+ return createMatcher((value) => typeof value === "boolean", () => "boolean", () => "Boolean()");
7
+ }
8
+ //# sourceMappingURL=type-boolean.match.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-boolean.match.js","sourceRoot":"","sources":["../../../src/assert/type-boolean/type-boolean.match.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE5E;;GAEG;AACH,MAAM,UAAU,WAAW;IACzB,OAAO,aAAa,CAClB,CAAC,KAAK,EAAoB,EAAE,CAAC,OAAO,KAAK,KAAK,SAAS,EACvD,GAAG,EAAE,CAAC,SAAS,EACf,GAAG,EAAE,CAAC,WAAW,CAClB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=type-boolean.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-boolean.test.d.ts","sourceRoot":"","sources":["../../../src/assert/type-boolean/type-boolean.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,64 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { assertTypeBoolean } from "./type-boolean.assert.js";
3
+ import { desc, repr } from "../../describe/describe.js";
4
+ import { typeBoolean } from "./type-boolean.match.js";
5
+ describe("type-boolean", () => {
6
+ describe("assertTypeBoolean", () => {
7
+ it("throws when value is not a boolean", () => {
8
+ expect(() => {
9
+ assertTypeBoolean("true");
10
+ }).toThrow('Expected string "true" to be of type boolean.');
11
+ });
12
+ it("does not throw when value is a boolean", () => {
13
+ expect(() => {
14
+ assertTypeBoolean(true);
15
+ }).not.toThrow();
16
+ expect(() => {
17
+ assertTypeBoolean(false);
18
+ }).not.toThrow();
19
+ });
20
+ it("throws with custom message", () => {
21
+ expect(() => {
22
+ assertTypeBoolean(1, "Custom error message");
23
+ }).toThrow("Custom error message");
24
+ });
25
+ it("works with various non-boolean types", () => {
26
+ expect(() => {
27
+ assertTypeBoolean(null);
28
+ }).toThrow("Expected null to be of type boolean.");
29
+ expect(() => {
30
+ assertTypeBoolean(undefined);
31
+ }).toThrow("Expected undefined to be of type boolean.");
32
+ expect(() => {
33
+ assertTypeBoolean(1);
34
+ }).toThrow("Expected number 1 to be of type boolean.");
35
+ expect(() => {
36
+ assertTypeBoolean({});
37
+ }).toThrow("Expected object {} to be of type boolean.");
38
+ });
39
+ });
40
+ describe("typeBoolean", () => {
41
+ it("matches boolean values", () => {
42
+ const matcher = typeBoolean();
43
+ expect(matcher.matches(true)).toBe(true);
44
+ expect(matcher.matches(false)).toBe(true);
45
+ });
46
+ it("does not match non-boolean values", () => {
47
+ const matcher = typeBoolean();
48
+ expect(matcher.matches("true")).toBe(false);
49
+ expect(matcher.matches(null)).toBe(false);
50
+ expect(matcher.matches(undefined)).toBe(false);
51
+ expect(matcher.matches(1)).toBe(false);
52
+ expect(matcher.matches({})).toBe(false);
53
+ });
54
+ it("describes the matcher", () => {
55
+ const matcher = typeBoolean();
56
+ expect(desc(matcher)).toBe("boolean");
57
+ });
58
+ it("represents the matcher", () => {
59
+ const matcher = typeBoolean();
60
+ expect(repr(matcher)).toBe("Boolean()");
61
+ });
62
+ });
63
+ });
64
+ //# sourceMappingURL=type-boolean.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AC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC/C,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACvC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC1C,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,uBAAuB,EAAE,GAAG,EAAE;YAC/B,MAAM,OAAO,GAAG,WAAW,EAAE,CAAC;YAC9B,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACxC,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,wBAAwB,EAAE,GAAG,EAAE;YAChC,MAAM,OAAO,GAAG,WAAW,EAAE,CAAC;YAC9B,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC1C,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"type-function.assert.d.ts","sourceRoot":"","sources":["../../../src/assert/type-function/type-function.assert.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,OAAO,EACd,OAAO,SAAoD,GAE1D,OAAO,CAAC,KAAK,IAAI,QAAQ,CAI3B"}
1
+ {"version":3,"file":"type-function.assert.d.ts","sourceRoot":"","sources":["../../../src/assert/type-function/type-function.assert.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,OAAO,EACd,OAAO,SAAoD,GAE1D,OAAO,CAAC,KAAK,IAAI,QAAQ,CAK3B"}
@@ -1,11 +1,13 @@
1
1
  import { AssertionError } from "../../assertion-error.js";
2
2
  import { desc } from "../../describe/describe.js";
3
+ import { typeFunction } from "./type-function.match.js";
3
4
  /**
4
5
  * Assert that a value is of type function, with type-narrowing.
5
6
  */
6
7
  export function assertTypeFunction(value, message = `Expected ${desc(value)} to be of type function.`) {
7
- if (typeof value !== "function") {
8
- throw new AssertionError(message, typeof value, "function");
8
+ const matcher = typeFunction();
9
+ if (!matcher.matches(value)) {
10
+ throw new AssertionError(message, value, matcher.represent());
9
11
  }
10
12
  }
11
13
  //# sourceMappingURL=type-function.assert.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"type-function.assert.js","sourceRoot":"","sources":["../../../src/assert/type-function/type-function.assert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAElD;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAChC,KAAc,EACd,OAAO,GAAG,YAAY,IAAI,CAAC,KAAK,CAAC,0BAA0B;IAG3D,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE,CAAC;QAChC,MAAM,IAAI,cAAc,CAAC,OAAO,EAAE,OAAO,KAAK,EAAE,UAAU,CAAC,CAAC;IAC9D,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"type-function.assert.js","sourceRoot":"","sources":["../../../src/assert/type-function/type-function.assert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAChC,KAAc,EACd,OAAO,GAAG,YAAY,IAAI,CAAC,KAAK,CAAC,0BAA0B;IAG3D,MAAM,OAAO,GAAG,YAAY,EAAE,CAAC;IAC/B,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,cAAc,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;IAChE,CAAC;AACH,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { type AssertionMatcher } from "../../match/match.js";
2
+ /**
3
+ * Matcher for a function value.
4
+ */
5
+ export declare function typeFunction(): AssertionMatcher<Function>;
6
+ //# sourceMappingURL=type-function.match.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-function.match.d.ts","sourceRoot":"","sources":["../../../src/assert/type-function/type-function.match.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAiB,MAAM,sBAAsB,CAAC;AAE5E;;GAEG;AAEH,wBAAgB,YAAY,IAAI,gBAAgB,CAAC,QAAQ,CAAC,CAOzD"}
@@ -0,0 +1,11 @@
1
+ import { createMatcher } from "../../match/match.js";
2
+ /**
3
+ * Matcher for a function value.
4
+ */
5
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
6
+ export function typeFunction() {
7
+ return createMatcher(
8
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
9
+ (value) => typeof value === "function", () => "function", () => "Function()");
10
+ }
11
+ //# sourceMappingURL=type-function.match.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-function.match.js","sourceRoot":"","sources":["../../../src/assert/type-function/type-function.match.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE5E;;GAEG;AACH,sEAAsE;AACtE,MAAM,UAAU,YAAY;IAC1B,OAAO,aAAa;IAClB,sEAAsE;IACtE,CAAC,KAAK,EAAqB,EAAE,CAAC,OAAO,KAAK,KAAK,UAAU,EACzD,GAAG,EAAE,CAAC,UAAU,EAChB,GAAG,EAAE,CAAC,YAAY,CACnB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=type-function.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-function.test.d.ts","sourceRoot":"","sources":["../../../src/assert/type-function/type-function.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,84 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { assertTypeFunction } from "./type-function.assert.js";
3
+ import { desc, repr } from "../../describe/describe.js";
4
+ import { typeFunction } from "./type-function.match.js";
5
+ describe("type-function", () => {
6
+ describe("assertTypeFunction", () => {
7
+ it("throws when value is not a function", () => {
8
+ expect(() => {
9
+ assertTypeFunction("foobar");
10
+ }).toThrow('Expected string "foobar" to be of type function.');
11
+ });
12
+ it("does not throw when value is a function", () => {
13
+ expect(() => {
14
+ assertTypeFunction(() => {
15
+ /* empty */
16
+ });
17
+ }).not.toThrow();
18
+ expect(() => {
19
+ assertTypeFunction(function () {
20
+ /* empty */
21
+ });
22
+ }).not.toThrow();
23
+ expect(() => {
24
+ assertTypeFunction(async () => {
25
+ /* empty */
26
+ });
27
+ }).not.toThrow();
28
+ });
29
+ it("throws with custom message", () => {
30
+ expect(() => {
31
+ assertTypeFunction(123, "Custom error message");
32
+ }).toThrow("Custom error message");
33
+ });
34
+ it("works with various non-function types", () => {
35
+ expect(() => {
36
+ assertTypeFunction(null);
37
+ }).toThrow("Expected null to be of type function.");
38
+ expect(() => {
39
+ assertTypeFunction(undefined);
40
+ }).toThrow("Expected undefined to be of type function.");
41
+ expect(() => {
42
+ assertTypeFunction(true);
43
+ }).toThrow("Expected boolean true to be of type function.");
44
+ expect(() => {
45
+ assertTypeFunction(123);
46
+ }).toThrow("Expected number 123 to be of type function.");
47
+ expect(() => {
48
+ assertTypeFunction({});
49
+ }).toThrow("Expected object {} to be of type function.");
50
+ });
51
+ });
52
+ describe("typeFunction", () => {
53
+ it("matches function values", () => {
54
+ const matcher = typeFunction();
55
+ expect(matcher.matches(() => {
56
+ //
57
+ })).toBe(true);
58
+ expect(matcher.matches(function () {
59
+ //
60
+ })).toBe(true);
61
+ expect(matcher.matches(async () => {
62
+ //
63
+ })).toBe(true);
64
+ });
65
+ it("does not match non-function values", () => {
66
+ const matcher = typeFunction();
67
+ expect(matcher.matches("foobar")).toBe(false);
68
+ expect(matcher.matches(null)).toBe(false);
69
+ expect(matcher.matches(undefined)).toBe(false);
70
+ expect(matcher.matches(true)).toBe(false);
71
+ expect(matcher.matches(123)).toBe(false);
72
+ expect(matcher.matches({})).toBe(false);
73
+ });
74
+ it("describes the matcher", () => {
75
+ const matcher = typeFunction();
76
+ expect(desc(matcher)).toBe("function");
77
+ });
78
+ it("represents the matcher", () => {
79
+ const matcher = typeFunction();
80
+ expect(repr(matcher)).toBe("Function()");
81
+ });
82
+ });
83
+ });
84
+ //# sourceMappingURL=type-function.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-function.test.js","sourceRoot":"","sources":["../../../src/assert/type-function/type-function.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC7B,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;QAClC,EAAE,CAAC,qCAAqC,EAAE,GAAG,EAAE;YAC7C,MAAM,CAAC,GAAG,EAAE;gBACV,kBAAkB,CAAC,QAAQ,CAAC,CAAC;YAC/B,CAAC,CAAC,CAAC,OAAO,CAAC,kDAAkD,CAAC,CAAC;QACjE,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,yCAAyC,EAAE,GAAG,EAAE;YACjD,MAAM,CAAC,GAAG,EAAE;gBACV,kBAAkB,CAAC,GAAG,EAAE;oBACtB,WAAW;gBACb,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;Y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AC,CAAC,CAAC;QAEH,EAAE,CAAC,uBAAuB,EAAE,GAAG,EAAE;YAC/B,MAAM,OAAO,GAAG,YAAY,EAAE,CAAC;YAC/B,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACzC,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,wBAAwB,EAAE,GAAG,EAAE;YAChC,MAAM,OAAO,GAAG,YAAY,EAAE,CAAC;YAC/B,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAC3C,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"type-number.assert.d.ts","sourceRoot":"","sources":["../../../src/assert/type-number/type-number.assert.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,OAAO,EACd,OAAO,SAAkD,GACxD,OAAO,CAAC,KAAK,IAAI,MAAM,CAIzB"}
1
+ {"version":3,"file":"type-number.assert.d.ts","sourceRoot":"","sources":["../../../src/assert/type-number/type-number.assert.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,OAAO,EACd,OAAO,SAAkD,GACxD,OAAO,CAAC,KAAK,IAAI,MAAM,CAKzB"}
@@ -1,11 +1,13 @@
1
1
  import { AssertionError } from "../../assertion-error.js";
2
2
  import { desc } from "../../describe/describe.js";
3
+ import { typeNumber } from "./type-number.match.js";
3
4
  /**
4
5
  * Assert that a value is of type number, with type-narrowing.
5
6
  */
6
7
  export function assertTypeNumber(value, message = `Expected ${desc(value)} to be of type number.`) {
7
- if (typeof value !== "number") {
8
- throw new AssertionError(message, typeof value, "number");
8
+ const matcher = typeNumber();
9
+ if (!matcher.matches(value)) {
10
+ throw new AssertionError(message, value, matcher.represent());
9
11
  }
10
12
  }
11
13
  //# sourceMappingURL=type-number.assert.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"type-number.assert.js","sourceRoot":"","sources":["../../../src/assert/type-number/type-number.assert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAElD;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAC9B,KAAc,EACd,OAAO,GAAG,YAAY,IAAI,CAAC,KAAK,CAAC,wBAAwB;IAEzD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,IAAI,cAAc,CAAC,OAAO,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC5D,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"type-number.assert.js","sourceRoot":"","sources":["../../../src/assert/type-number/type-number.assert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAC9B,KAAc,EACd,OAAO,GAAG,YAAY,IAAI,CAAC,KAAK,CAAC,wBAAwB;IAEzD,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,cAAc,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;IAChE,CAAC;AACH,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { type AssertionMatcher } from "../../match/match.js";
2
+ /**
3
+ * Matcher for a number value.
4
+ */
5
+ export declare function typeNumber(): AssertionMatcher<number>;
6
+ //# sourceMappingURL=type-number.match.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-number.match.d.ts","sourceRoot":"","sources":["../../../src/assert/type-number/type-number.match.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAiB,MAAM,sBAAsB,CAAC;AAE5E;;GAEG;AACH,wBAAgB,UAAU,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAMrD"}
@@ -0,0 +1,8 @@
1
+ import { createMatcher } from "../../match/match.js";
2
+ /**
3
+ * Matcher for a number value.
4
+ */
5
+ export function typeNumber() {
6
+ return createMatcher((value) => typeof value === "number", () => "number", () => "Number()");
7
+ }
8
+ //# sourceMappingURL=type-number.match.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-number.match.js","sourceRoot":"","sources":["../../../src/assert/type-number/type-number.match.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE5E;;GAEG;AACH,MAAM,UAAU,UAAU;IACxB,OAAO,aAAa,CAClB,CAAC,KAAK,EAAmB,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,EACrD,GAAG,EAAE,CAAC,QAAQ,EACd,GAAG,EAAE,CAAC,UAAU,CACjB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=type-number.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-number.test.d.ts","sourceRoot":"","sources":["../../../src/assert/type-number/type-number.test.ts"],"names":[],"mappings":""}