hein 1.4.2 → 2.0.0-alpha.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 (303) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/ESM_MIGRATION_NOTES.md +6 -0
  3. package/README.md +46 -7
  4. package/dist/assert-9EsvfQwn.d.cts +483 -0
  5. package/dist/assert-9EsvfQwn.d.cts.map +1 -0
  6. package/dist/assert-B_vcZS90.d.ts +481 -0
  7. package/dist/assert-B_vcZS90.d.ts.map +1 -0
  8. package/dist/assert-DZjgWjOw.cjs +1626 -0
  9. package/dist/assert-DZjgWjOw.cjs.map +1 -0
  10. package/dist/assert-kFXp7i_B.js +1260 -0
  11. package/dist/assert-kFXp7i_B.js.map +1 -0
  12. package/dist/assert.cjs +53 -0
  13. package/dist/assert.d.cts +3 -0
  14. package/dist/assert.d.ts +3 -27
  15. package/dist/assert.js +3 -84
  16. package/dist/chunk-CTAAG5j7.js +13 -0
  17. package/dist/expect.types-DPl6xY56.d.ts +99 -0
  18. package/dist/expect.types-DPl6xY56.d.ts.map +1 -0
  19. package/dist/expect.types-s8icgWp5.d.cts +99 -0
  20. package/dist/expect.types-s8icgWp5.d.cts.map +1 -0
  21. package/dist/expect.types.cjs +0 -0
  22. package/dist/expect.types.d.cts +3 -0
  23. package/dist/expect.types.d.ts +3 -66
  24. package/dist/expect.types.js +1 -4
  25. package/dist/index.cjs +596 -0
  26. package/dist/index.cjs.map +1 -0
  27. package/dist/index.d.cts +16 -0
  28. package/dist/index.d.cts.map +1 -0
  29. package/dist/index.d.ts +15 -8
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/index.js +573 -27
  32. package/dist/index.js.map +1 -1
  33. package/dist/throws-BrCCeBBl.d.ts +42 -0
  34. package/dist/throws-BrCCeBBl.d.ts.map +1 -0
  35. package/dist/throws-D7JsW4NM.d.cts +40 -0
  36. package/dist/throws-D7JsW4NM.d.cts.map +1 -0
  37. package/eslint.config.mjs +13 -0
  38. package/package.json +31 -18
  39. package/tsdown.config.ts +9 -0
  40. package/dist/assert/deep-equal.d.ts +0 -2
  41. package/dist/assert/deep-equal.d.ts.map +0 -1
  42. package/dist/assert/deep-equal.js +0 -26
  43. package/dist/assert/deep-equal.js.map +0 -1
  44. package/dist/assert/deep-has-property.d.ts +0 -20
  45. package/dist/assert/deep-has-property.d.ts.map +0 -1
  46. package/dist/assert/deep-has-property.js +0 -50
  47. package/dist/assert/deep-has-property.js.map +0 -1
  48. package/dist/assert/ends-with.d.ts +0 -11
  49. package/dist/assert/ends-with.d.ts.map +0 -1
  50. package/dist/assert/ends-with.js +0 -30
  51. package/dist/assert/ends-with.js.map +0 -1
  52. package/dist/assert/equal.d.ts +0 -9
  53. package/dist/assert/equal.d.ts.map +0 -1
  54. package/dist/assert/equal.js +0 -21
  55. package/dist/assert/equal.js.map +0 -1
  56. package/dist/assert/greater-than-equal.d.ts +0 -9
  57. package/dist/assert/greater-than-equal.d.ts.map +0 -1
  58. package/dist/assert/greater-than-equal.js +0 -20
  59. package/dist/assert/greater-than-equal.js.map +0 -1
  60. package/dist/assert/greater-than.d.ts +0 -9
  61. package/dist/assert/greater-than.d.ts.map +0 -1
  62. package/dist/assert/greater-than.js +0 -20
  63. package/dist/assert/greater-than.js.map +0 -1
  64. package/dist/assert/has-keys.d.ts +0 -14
  65. package/dist/assert/has-keys.d.ts.map +0 -1
  66. package/dist/assert/has-keys.js +0 -47
  67. package/dist/assert/has-keys.js.map +0 -1
  68. package/dist/assert/has-members.d.ts +0 -46
  69. package/dist/assert/has-members.d.ts.map +0 -1
  70. package/dist/assert/has-members.js +0 -58
  71. package/dist/assert/has-members.js.map +0 -1
  72. package/dist/assert/has-property.d.ts +0 -20
  73. package/dist/assert/has-property.d.ts.map +0 -1
  74. package/dist/assert/has-property.js +0 -47
  75. package/dist/assert/has-property.js.map +0 -1
  76. package/dist/assert/has-size.d.ts +0 -40
  77. package/dist/assert/has-size.d.ts.map +0 -1
  78. package/dist/assert/has-size.js +0 -68
  79. package/dist/assert/has-size.js.map +0 -1
  80. package/dist/assert/in-ballpark.d.ts +0 -14
  81. package/dist/assert/in-ballpark.d.ts.map +0 -1
  82. package/dist/assert/in-ballpark.js +0 -26
  83. package/dist/assert/in-ballpark.js.map +0 -1
  84. package/dist/assert/includes.d.ts +0 -22
  85. package/dist/assert/includes.d.ts.map +0 -1
  86. package/dist/assert/includes.js +0 -32
  87. package/dist/assert/includes.js.map +0 -1
  88. package/dist/assert/instance-of.d.ts +0 -13
  89. package/dist/assert/instance-of.d.ts.map +0 -1
  90. package/dist/assert/instance-of.js +0 -35
  91. package/dist/assert/instance-of.js.map +0 -1
  92. package/dist/assert/is-after.d.ts +0 -9
  93. package/dist/assert/is-after.d.ts.map +0 -1
  94. package/dist/assert/is-after.js +0 -27
  95. package/dist/assert/is-after.js.map +0 -1
  96. package/dist/assert/is-before.d.ts +0 -9
  97. package/dist/assert/is-before.d.ts.map +0 -1
  98. package/dist/assert/is-before.js +0 -27
  99. package/dist/assert/is-before.js.map +0 -1
  100. package/dist/assert/is-between.d.ts +0 -13
  101. package/dist/assert/is-between.d.ts.map +0 -1
  102. package/dist/assert/is-between.js +0 -38
  103. package/dist/assert/is-between.js.map +0 -1
  104. package/dist/assert/is-empty.d.ts +0 -29
  105. package/dist/assert/is-empty.d.ts.map +0 -1
  106. package/dist/assert/is-empty.js +0 -48
  107. package/dist/assert/is-empty.js.map +0 -1
  108. package/dist/assert/is-type.d.ts +0 -94
  109. package/dist/assert/is-type.d.ts.map +0 -1
  110. package/dist/assert/is-type.js +0 -32
  111. package/dist/assert/is-type.js.map +0 -1
  112. package/dist/assert/less-than-equal.d.ts +0 -9
  113. package/dist/assert/less-than-equal.d.ts.map +0 -1
  114. package/dist/assert/less-than-equal.js +0 -27
  115. package/dist/assert/less-than-equal.js.map +0 -1
  116. package/dist/assert/less-than.d.ts +0 -9
  117. package/dist/assert/less-than.d.ts.map +0 -1
  118. package/dist/assert/less-than.js +0 -20
  119. package/dist/assert/less-than.js.map +0 -1
  120. package/dist/assert/match.d.ts +0 -13
  121. package/dist/assert/match.d.ts.map +0 -1
  122. package/dist/assert/match.js +0 -29
  123. package/dist/assert/match.js.map +0 -1
  124. package/dist/assert/rejects.d.ts +0 -33
  125. package/dist/assert/rejects.d.ts.map +0 -1
  126. package/dist/assert/rejects.js +0 -48
  127. package/dist/assert/rejects.js.map +0 -1
  128. package/dist/assert/round-to.d.ts +0 -13
  129. package/dist/assert/round-to.d.ts.map +0 -1
  130. package/dist/assert/round-to.js +0 -43
  131. package/dist/assert/round-to.js.map +0 -1
  132. package/dist/assert/starts-with.d.ts +0 -12
  133. package/dist/assert/starts-with.d.ts.map +0 -1
  134. package/dist/assert/starts-with.js +0 -30
  135. package/dist/assert/starts-with.js.map +0 -1
  136. package/dist/assert/throws.d.ts +0 -33
  137. package/dist/assert/throws.d.ts.map +0 -1
  138. package/dist/assert/throws.js +0 -40
  139. package/dist/assert/throws.js.map +0 -1
  140. package/dist/assert.d.ts.map +0 -1
  141. package/dist/assert.js.map +0 -1
  142. package/dist/expect/after.d.ts +0 -11
  143. package/dist/expect/after.d.ts.map +0 -1
  144. package/dist/expect/after.js +0 -18
  145. package/dist/expect/after.js.map +0 -1
  146. package/dist/expect/ballpark.d.ts +0 -12
  147. package/dist/expect/ballpark.d.ts.map +0 -1
  148. package/dist/expect/ballpark.js +0 -18
  149. package/dist/expect/ballpark.js.map +0 -1
  150. package/dist/expect/before.d.ts +0 -11
  151. package/dist/expect/before.d.ts.map +0 -1
  152. package/dist/expect/before.js +0 -18
  153. package/dist/expect/before.js.map +0 -1
  154. package/dist/expect/between.d.ts +0 -21
  155. package/dist/expect/between.d.ts.map +0 -1
  156. package/dist/expect/between.js +0 -18
  157. package/dist/expect/between.js.map +0 -1
  158. package/dist/expect/empty.d.ts +0 -16
  159. package/dist/expect/empty.d.ts.map +0 -1
  160. package/dist/expect/empty.js +0 -18
  161. package/dist/expect/empty.js.map +0 -1
  162. package/dist/expect/end-with.d.ts +0 -12
  163. package/dist/expect/end-with.d.ts.map +0 -1
  164. package/dist/expect/end-with.js +0 -18
  165. package/dist/expect/end-with.js.map +0 -1
  166. package/dist/expect/eql.d.ts +0 -11
  167. package/dist/expect/eql.d.ts.map +0 -1
  168. package/dist/expect/eql.js +0 -22
  169. package/dist/expect/eql.js.map +0 -1
  170. package/dist/expect/equal-shorthand.d.ts +0 -14
  171. package/dist/expect/equal-shorthand.d.ts.map +0 -1
  172. package/dist/expect/equal-shorthand.js +0 -34
  173. package/dist/expect/equal-shorthand.js.map +0 -1
  174. package/dist/expect/equal.d.ts +0 -14
  175. package/dist/expect/equal.d.ts.map +0 -1
  176. package/dist/expect/equal.js +0 -28
  177. package/dist/expect/equal.js.map +0 -1
  178. package/dist/expect/excluding.d.ts +0 -11
  179. package/dist/expect/excluding.d.ts.map +0 -1
  180. package/dist/expect/excluding.js +0 -14
  181. package/dist/expect/excluding.js.map +0 -1
  182. package/dist/expect/greater-than-equal.d.ts +0 -32
  183. package/dist/expect/greater-than-equal.d.ts.map +0 -1
  184. package/dist/expect/greater-than-equal.js +0 -20
  185. package/dist/expect/greater-than-equal.js.map +0 -1
  186. package/dist/expect/greater-than.d.ts +0 -32
  187. package/dist/expect/greater-than.d.ts.map +0 -1
  188. package/dist/expect/greater-than.js +0 -20
  189. package/dist/expect/greater-than.js.map +0 -1
  190. package/dist/expect/has-property.d.ts +0 -36
  191. package/dist/expect/has-property.d.ts.map +0 -1
  192. package/dist/expect/has-property.js +0 -22
  193. package/dist/expect/has-property.js.map +0 -1
  194. package/dist/expect/include.d.ts +0 -25
  195. package/dist/expect/include.d.ts.map +0 -1
  196. package/dist/expect/include.js +0 -22
  197. package/dist/expect/include.js.map +0 -1
  198. package/dist/expect/instance-of-shorthand.d.ts +0 -34
  199. package/dist/expect/instance-of-shorthand.d.ts.map +0 -1
  200. package/dist/expect/instance-of-shorthand.js +0 -22
  201. package/dist/expect/instance-of-shorthand.js.map +0 -1
  202. package/dist/expect/instance-of.d.ts +0 -11
  203. package/dist/expect/instance-of.d.ts.map +0 -1
  204. package/dist/expect/instance-of.js +0 -18
  205. package/dist/expect/instance-of.js.map +0 -1
  206. package/dist/expect/keys.d.ts +0 -17
  207. package/dist/expect/keys.d.ts.map +0 -1
  208. package/dist/expect/keys.js +0 -18
  209. package/dist/expect/keys.js.map +0 -1
  210. package/dist/expect/length.d.ts +0 -28
  211. package/dist/expect/length.d.ts.map +0 -1
  212. package/dist/expect/length.js +0 -19
  213. package/dist/expect/length.js.map +0 -1
  214. package/dist/expect/less-than-equal.d.ts +0 -32
  215. package/dist/expect/less-than-equal.d.ts.map +0 -1
  216. package/dist/expect/less-than-equal.js +0 -20
  217. package/dist/expect/less-than-equal.js.map +0 -1
  218. package/dist/expect/less-than.d.ts +0 -32
  219. package/dist/expect/less-than.d.ts.map +0 -1
  220. package/dist/expect/less-than.js +0 -20
  221. package/dist/expect/less-than.js.map +0 -1
  222. package/dist/expect/match.d.ts +0 -10
  223. package/dist/expect/match.d.ts.map +0 -1
  224. package/dist/expect/match.js +0 -18
  225. package/dist/expect/match.js.map +0 -1
  226. package/dist/expect/members.d.ts +0 -20
  227. package/dist/expect/members.d.ts.map +0 -1
  228. package/dist/expect/members.js +0 -32
  229. package/dist/expect/members.js.map +0 -1
  230. package/dist/expect/reject.d.ts +0 -12
  231. package/dist/expect/reject.d.ts.map +0 -1
  232. package/dist/expect/reject.js +0 -13
  233. package/dist/expect/reject.js.map +0 -1
  234. package/dist/expect/round-to.d.ts +0 -12
  235. package/dist/expect/round-to.d.ts.map +0 -1
  236. package/dist/expect/round-to.js +0 -18
  237. package/dist/expect/round-to.js.map +0 -1
  238. package/dist/expect/start-with.d.ts +0 -12
  239. package/dist/expect/start-with.d.ts.map +0 -1
  240. package/dist/expect/start-with.js +0 -18
  241. package/dist/expect/start-with.js.map +0 -1
  242. package/dist/expect/throw.d.ts +0 -12
  243. package/dist/expect/throw.d.ts.map +0 -1
  244. package/dist/expect/throw.js +0 -13
  245. package/dist/expect/throw.js.map +0 -1
  246. package/dist/expect/type-shorthand.d.ts +0 -66
  247. package/dist/expect/type-shorthand.d.ts.map +0 -1
  248. package/dist/expect/type-shorthand.js +0 -34
  249. package/dist/expect/type-shorthand.js.map +0 -1
  250. package/dist/expect/type.d.ts +0 -10
  251. package/dist/expect/type.d.ts.map +0 -1
  252. package/dist/expect/type.js +0 -18
  253. package/dist/expect/type.js.map +0 -1
  254. package/dist/expect.d.ts +0 -33
  255. package/dist/expect.d.ts.map +0 -1
  256. package/dist/expect.js +0 -88
  257. package/dist/expect.js.map +0 -1
  258. package/dist/expect.types.d.ts.map +0 -1
  259. package/dist/expect.types.js.map +0 -1
  260. package/dist/mixins.d.ts +0 -26
  261. package/dist/mixins.d.ts.map +0 -1
  262. package/dist/mixins.js +0 -9
  263. package/dist/mixins.js.map +0 -1
  264. package/dist/utils/cast-array.d.ts +0 -2
  265. package/dist/utils/cast-array.d.ts.map +0 -1
  266. package/dist/utils/cast-array.js +0 -14
  267. package/dist/utils/cast-array.js.map +0 -1
  268. package/dist/utils/chain.d.ts +0 -3
  269. package/dist/utils/chain.d.ts.map +0 -1
  270. package/dist/utils/chain.js +0 -21
  271. package/dist/utils/chain.js.map +0 -1
  272. package/dist/utils/fail.d.ts +0 -6
  273. package/dist/utils/fail.d.ts.map +0 -1
  274. package/dist/utils/fail.js +0 -13
  275. package/dist/utils/fail.js.map +0 -1
  276. package/dist/utils/get-size.d.ts +0 -2
  277. package/dist/utils/get-size.d.ts.map +0 -1
  278. package/dist/utils/get-size.js +0 -24
  279. package/dist/utils/get-size.js.map +0 -1
  280. package/dist/utils/get-type.d.ts +0 -3
  281. package/dist/utils/get-type.d.ts.map +0 -1
  282. package/dist/utils/get-type.js +0 -17
  283. package/dist/utils/get-type.js.map +0 -1
  284. package/dist/utils/match.d.ts +0 -15
  285. package/dist/utils/match.d.ts.map +0 -1
  286. package/dist/utils/match.js +0 -150
  287. package/dist/utils/match.js.map +0 -1
  288. package/dist/utils/process-error.d.ts +0 -11
  289. package/dist/utils/process-error.d.ts.map +0 -1
  290. package/dist/utils/process-error.js +0 -98
  291. package/dist/utils/process-error.js.map +0 -1
  292. package/dist/utils/types.d.ts +0 -4
  293. package/dist/utils/types.d.ts.map +0 -1
  294. package/dist/utils/types.js +0 -3
  295. package/dist/utils/types.js.map +0 -1
  296. package/dist/utils/validate-numeric-and-dates.d.ts +0 -2
  297. package/dist/utils/validate-numeric-and-dates.d.ts.map +0 -1
  298. package/dist/utils/validate-numeric-and-dates.js +0 -15
  299. package/dist/utils/validate-numeric-and-dates.js.map +0 -1
  300. package/dist/utils/xor.d.ts +0 -2
  301. package/dist/utils/xor.d.ts.map +0 -1
  302. package/dist/utils/xor.js +0 -8
  303. package/dist/utils/xor.js.map +0 -1
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,qCAAmC;AACnC,uCAAsD;AAA7C,yGAAA,gBAAgB,OAAA;AAAE,4FAAA,GAAG,OAAA;AAC9B,mCAA+D;AAAtD,6FAAA,GAAG,OAAA;AACZ,6DAAsD;AAA7C,sHAAA,cAAc,OAAA;AAGvB,qCAAoC;AAA3B,4FAAA,IAAI,OAAA"}
1
+ {"version":3,"file":"index.js","names":["mixins: Record<string, Property | Method | Alias>","AssertionError"],"sources":["../src/mixins.ts","../src/utils/chain.ts","../src/utils/get-size.ts","../src/expect/after.ts","../src/expect/ballpark.ts","../src/expect/before.ts","../src/expect/between.ts","../src/expect/empty.ts","../src/expect/end-with.ts","../src/expect/eql.ts","../src/expect/equal-shorthand.ts","../src/expect/equal.ts","../src/expect/excluding.ts","../src/expect/greater-than-equal.ts","../src/expect/greater-than.ts","../src/expect/has-property.ts","../src/expect/include.ts","../src/expect/instance-of-shorthand.ts","../src/expect/instance-of.ts","../src/expect/keys.ts","../src/expect/length.ts","../src/expect/less-than-equal.ts","../src/expect/less-than.ts","../src/expect/match.ts","../src/expect/members.ts","../src/expect/reject.ts","../src/expect/round-to.ts","../src/expect/start-with.ts","../src/expect/throw.ts","../src/expect/type-shorthand.ts","../src/expect/type.ts","../src/utils/fail.ts","../src/expect.ts"],"sourcesContent":["export interface State<T> {\n inverted?: boolean;\n value?: T;\n getProperty?: (value: T) => any;\n deep?: boolean;\n same?: boolean;\n ordered?: boolean;\n partial?: boolean;\n\n every?: boolean;\n}\n\nexport interface Property {\n type: 'property';\n value: (state: State<any>) => Partial<State<any>> | null;\n}\n\ntype MethodCallback = (state: State<any>) => (...args: any[]) => void;\n\nexport interface Method {\n type: 'method';\n value: MethodCallback;\n}\n\nexport interface Alias {\n type: 'alias';\n value: string;\n}\n\nexport const mixins: Record<string, Property | Method | Alias> = {};\n\nexport const use = (plugins: Record<string, Property | Method | Alias>) => {\n Object.assign(mixins, plugins);\n};\n","export const registerProperty = <T, U extends string, V extends () => any>(object: T, name: U, value: V) => {\n Object.defineProperty(object, name, {\n enumerable: true,\n get() {\n return value();\n }\n });\n return object as T & Record<U, V>;\n};\n\nexport const registerMethod = <T, U extends string, V>(object: T, name: U, value: V) => {\n Object.defineProperty(object, name, {\n value\n });\n return object as T & Record<U, V>;\n};\n","import isPlainObject from 'lodash/isPlainObject.js';\n\nexport const getSize = (value: any) => {\n if (Array.isArray(value)) {\n return value.length;\n }\n if (isPlainObject(value)) {\n return Object.keys(value).length;\n }\n if (value instanceof Map) {\n return value.size;\n }\n if (value instanceof Set) {\n return value.size;\n }\n if (typeof value === 'string') {\n return value.length;\n }\n return 0;\n};\n","import { isAfter, notAfter } from '../assert.js';\nimport { use } from '../mixins.js';\n\ndeclare module '../expect.types' {\n interface DateExpect {\n /**\n * check if date is after other date\n * @param date\n */\n after(date: Date): this;\n }\n}\n\nuse({\n after: {\n type: 'method',\n value:\n ({ value, inverted }) =>\n (date: Date) => {\n if (inverted) {\n notAfter(value, date);\n } else {\n isAfter(value, date);\n }\n }\n }\n});\n","import { inBallpark, notInBallpark } from '../assert.js';\nimport { use } from '../mixins.js';\n\ndeclare module '../expect.types' {\n interface NumberExpect {\n /**\n * check if number close enough (default 10%)\n * @param ballpark\n * @param [multiplier=10] - a number between 0 and 1 (exclusive). 0.1 (default) means 10% difference is allowed.\n */\n ballpark(ballpark: number, multiplier?: number): this;\n }\n}\n\nuse({\n ballpark: {\n type: 'method',\n value:\n ({ value, inverted }) =>\n (ballpark, multiplier = 0.1) => {\n if (inverted) {\n notInBallpark(value, ballpark, multiplier);\n } else {\n inBallpark(value, ballpark, multiplier);\n }\n }\n }\n});\n","import { isBefore, notBefore } from '../assert.js';\nimport { use } from '../mixins.js';\n\ndeclare module '../expect.types' {\n interface DateExpect {\n /**\n * check if date is before other date\n * @param date\n */\n before(date: Date): this;\n }\n}\n\nuse({\n before: {\n type: 'method',\n value:\n ({ value, inverted }) =>\n (date: Date) => {\n if (inverted) {\n notBefore(value, date);\n } else {\n isBefore(value, date);\n }\n }\n }\n});\n","import { isBetween, notBetween } from '../assert.js';\nimport { use } from '../mixins.js';\n\ndeclare module '../expect.types' {\n interface DateExpect {\n /**\n * check if date is between other dates\n * @param start\n * @param end\n */\n between(start: Date, end: Date, inclusive?: boolean): this;\n }\n interface NumberExpect {\n /**\n * check if number is between other numbers\n * @param start\n * @param end\n * @param inclusive\n */\n between(start: number, end: number, inclusive?: boolean): this;\n }\n}\n\nuse({\n between: {\n type: 'method',\n value:\n ({ value, inverted }) =>\n (start: Date, end: Date, inclusive = true) => {\n if (inverted) {\n notBetween(value, start, end, { inclusive });\n } else {\n isBetween(value, start, end, { inclusive });\n }\n }\n }\n});\n","import { isEmpty, notIsEmpty } from '../assert.js';\nimport { use } from '../mixins.js';\n\ndeclare module '../expect.types' {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n interface ObjectExpect<T> {\n /**\n * check if object/array/Map/Set is empty\n */\n empty(message?: string): this;\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n interface MapExpect<T> {\n /**\n * check if Map is empty\n */\n empty(message?: string): this;\n }\n}\n\nuse({\n empty: {\n type: 'method',\n value:\n ({ value, inverted }) =>\n (message?: string) => {\n if (inverted) {\n notIsEmpty(value, message);\n } else {\n isEmpty(value, message);\n }\n }\n }\n});\n","import { endsWith, notEndsWith } from '../assert.js';\nimport { use } from '../mixins.js';\n\ndeclare module '../expect.types' {\n interface StringExpect {\n /**\n * check if string ends with other string\n * @param start\n * @example endsWith('foo', 'o');\n */\n endWith(end: string): this;\n }\n}\n\nuse({\n endWith: {\n type: 'method',\n value:\n ({ value, inverted }) =>\n (end: string) => {\n if (inverted) {\n notEndsWith(value, end);\n } else {\n endsWith(value, end);\n }\n }\n }\n});\n","import { deepEqual, notDeepEqual } from '../assert.js';\nimport { use } from '../mixins.js';\nimport { type DeepPartial } from '../utils/types.js';\n\ndeclare module '../expect.types' {\n interface ValueExpect<T> {\n /**\n * check for deep equality\n */\n eql(value: T, message?: string): this;\n partially: ValueExpect<DeepPartial<T>>;\n }\n}\n\nuse({\n partially: {\n type: 'property',\n value: () => ({ partial: true })\n },\n eql: {\n type: 'method',\n value:\n ({ value, inverted, partial }) =>\n (other: any, message) => {\n if (inverted) {\n notDeepEqual(value, other, partial, message);\n } else {\n deepEqual(value, other, partial, message);\n }\n }\n }\n});\n","import { equal, notEqual } from '../assert.js';\nimport { type State, use } from '../mixins.js';\nimport { format } from 'hein-assertion-utils';\n\ndeclare module '../expect.types' {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n interface BooleanExpect<T> {\n /**\n * check if value is true\n */\n true(): this;\n /**\n * check if value is false\n */\n false(): this;\n }\n}\n\nconst values = {\n false: false,\n true: true\n};\n\nuse(\n Object.fromEntries(\n Object.entries(values).map(([key, expectValue]) => {\n return [\n key,\n {\n type: 'method',\n value:\n ({ inverted, value }: State<any>) =>\n () => {\n if (inverted) {\n const message = format(\n 'Expected {{= it.value }} to not be {{= it.key }}',\n {\n key,\n value\n },\n true\n );\n notEqual(value, expectValue, message);\n } else {\n const message = format(\n 'Expected {{= it.value }} to be {{= it.key }}',\n {\n key,\n value\n },\n true\n );\n equal(value, expectValue, message);\n }\n }\n }\n ];\n })\n )\n);\n","import { deepEqual, equal, notDeepEqual, notEqual } from '../assert.js';\nimport { use } from '../mixins.js';\n\ndeclare module '../expect.types' {\n interface ValueExpect<T> {\n /**\n * check for === equality, NaN is considered equal to NaN\n */\n equal(value: T, message?: string): this;\n /**\n * check for === equality, NaN is considered equal to NaN\n */\n eq(value: T, message?: string): this;\n }\n}\n\nuse({\n equal: {\n type: 'method',\n value:\n ({ value, inverted, deep }) =>\n (other: any, message?: string) => {\n if (deep) {\n if (inverted) {\n notDeepEqual(value, other, message);\n } else {\n deepEqual(value, other, message);\n }\n return;\n }\n if (inverted) {\n notEqual(value, other, message);\n } else {\n equal(value, other, message);\n }\n }\n },\n eq: { type: 'alias', value: 'equal' }\n});\n","import omit from 'lodash/omit.js';\nimport { use } from '../mixins.js';\nimport { expectChain } from '../expect.js';\n\ndeclare module '../expect.types' {\n interface ObjectExpect<T> {\n /**\n * exclude keys from object to be compared further down the chain\n * @param keys\n */\n excluding<K extends keyof T>(...keys: K[]): ObjectExpect<Omit<T, K>>;\n }\n}\n\nuse({\n excluding: {\n type: 'method',\n value:\n (state) =>\n (...keys: string[]) => {\n return expectChain({ ...state, value: omit(state.value, keys) });\n }\n }\n});\n","import { greaterThanEqual, notGreaterThanEqual } from '../assert.js';\nimport { use } from '../mixins.js';\n\ndeclare module '../expect.types' {\n interface NumberExpect<T> {\n /**\n * check if actual is greater than or equal to expected\n */\n greaterThanOrEqual(value: T): this;\n /**\n * check if actual is greater than or equal to expected\n */\n gte(value: T): this;\n /**\n * check if actual is greater than or equal to expected\n */\n atLeast(value: T): this;\n }\n interface DateExpect<T> {\n /**\n * check if actual is greater than or equal to expected\n */\n greaterThanOrEqual(value: T): this;\n /**\n * check if actual is greater than or equal to expected\n */\n gte(value: T): this;\n /**\n * check if actual is greater than or equal to expected\n */\n atLeast(value: T): this;\n }\n}\n\nuse({\n greaterThanOrEqual: {\n type: 'method',\n value:\n ({ value, inverted }) =>\n (other: any) => {\n if (inverted) {\n notGreaterThanEqual(value, other);\n } else {\n greaterThanEqual(value, other);\n }\n }\n },\n gte: { type: 'alias', value: 'greaterThanOrEqual' },\n atLeast: { type: 'alias', value: 'greaterThanOrEqual' }\n});\n","import { greaterThan, notGreaterThan } from '../assert.js';\nimport { use } from '../mixins.js';\n\ndeclare module '../expect.types' {\n interface NumberExpect<T> {\n /**\n * check if actual is greater than expected\n */\n greaterThan(value: T): this;\n /**\n * check if actual is greater than expected\n */\n gt(value: T): this;\n /**\n * check if actual is greater than expected\n */\n above(value: T): this;\n }\n interface DateExpect<T> {\n /**\n * check if actual is greater than expected\n */\n greaterThan(value: T): this;\n /**\n * check if actual is greater than expected\n */\n gt(value: T): this;\n /**\n * check if actual is greater than expected\n */\n above(value: T): this;\n }\n}\n\nuse({\n greaterThan: {\n type: 'method',\n value:\n ({ value, inverted }) =>\n (other: any) => {\n if (inverted) {\n notGreaterThan(value, other);\n } else {\n greaterThan(value, other);\n }\n }\n },\n gt: { type: 'alias', value: 'greaterThan' },\n above: { type: 'alias', value: 'greaterThan' }\n});\n","import { deepHasProperty, deepNotHasProperty, hasProperty, notHasProperty } from '../assert.js';\nimport { use } from '../mixins.js';\n\ndeclare module '../expect.types' {\n interface ValueExpect<T> {\n /**\n * check if value has a property\n * @param property a property in the object. When combined with .deep. can be a path like 'a.b.c'\n * @example expect({a: {b: {c: 1}}}).to.have.property('a.b.c');\n * @example expect({a: {b: {c: 1}}}).to.have.deep.property('[0].a.b.c');\n */\n property<K extends keyof T>(property: K): this;\n /**\n * check if value has a property\n * @param property a property in the object. When combined with .deep. can be a path like 'a.b.c'\n * @example expect({a: {b: {c: 1}}}).to.have.property('a.b.c');\n * @example expect({a: {b: {c: 1}}}).to.have.deep.property('[0].a.b.c');\n */\n property(property: string): this;\n /**\n * check if value has a property\n * @param property a property in the object. When combined with .deep. can be a path like 'a.b.c'\n * @param value\n * @example expect({a: {b: {c: 1}}}).to.have.property('a.b.c');\n * @example expect({a: {b: {c: 1}}}).to.have.deep.property('[0].a.b.c');\n */\n property<K extends keyof T>(property: K, value?: any): this;\n /**\n * check if value has a property\n * @param property a property in the object. When combined with .deep. can be a path like 'a.b.c'\n * @param value\n * @example expect({a: {b: {c: 1}}}).to.have.property('a.b.c');\n * @example expect({a: {b: {c: 1}}}).to.have.deep.property('[0].a.b.c');\n */\n property(property: string, value?: any): this;\n }\n}\n\nuse({\n property: {\n type: 'method',\n value:\n ({ value, inverted, deep }) =>\n (...args: [any, any]) => {\n if (deep) {\n if (inverted) {\n return deepNotHasProperty(value, ...args);\n }\n return deepHasProperty(value, ...args);\n }\n if (inverted) {\n return notHasProperty(value, ...args);\n }\n return hasProperty(value, ...args);\n }\n }\n});\n","import { includes, notIncludes } from '../assert.js';\nimport { use } from '../mixins.js';\n\ntype ArrayType<T> = T extends (infer U)[] ? U : T;\n\ndeclare module '../expect.types' {\n interface ArrayExpect<T> {\n /**\n * check if array includes element(s)\n */\n include(...elements: ArrayType<T>[]): this;\n /**\n * check if array includes element(s)\n */\n contain(...elements: ArrayType<T>[]): this;\n }\n interface StringExpect {\n /**\n * check if string includes substring(s)\n */\n include(...substrings: string[]): this;\n /**\n * check if string includes substring(s)\n */\n contain(...substrings: string[]): this;\n }\n}\n\nuse({\n include: {\n type: 'method',\n value:\n ({ value, inverted }) =>\n (...elements: any[]) => {\n if (inverted) {\n notIncludes(value, ...elements);\n } else {\n includes(value, ...elements);\n }\n }\n },\n contain: {\n type: 'alias',\n value: 'include'\n }\n});\n","import { instanceOf, notInstanceOf } from '../assert.js';\nimport { use } from '../mixins.js';\n\ndeclare module '../expect.types' {\n interface DateExpect {\n /**\n * check if value is an instance of Date\n */\n Date(): this;\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n interface ObjectExpect<T> {\n /**\n * check if value is an instance of Map\n */\n Map(): this;\n /**\n * check if value is an instance of Set\n */\n Set(): this;\n /**\n * check if value is an instance of WeakMap\n */\n WeakMap(): this;\n /**\n * check if value is an instance of WeakSet\n */\n WeakSet(): this;\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n interface MapExpect<T> {\n /**\n * check if value is an instance of Map\n */\n Map(): this;\n }\n}\n\nconst constructors = [Date, Map, Set, WeakMap, WeakSet];\n\nuse(\n Object.fromEntries(\n constructors.map((constructor) => {\n return [\n constructor.name,\n {\n type: 'method',\n value:\n ({ inverted, value }) =>\n () => {\n if (inverted) {\n notInstanceOf(value, constructor);\n } else {\n instanceOf(value, constructor);\n }\n }\n }\n ];\n })\n )\n);\n","import { notInstanceOf, instanceOf } from '../assert.js';\nimport { use } from '../mixins.js';\nimport { type Constructor } from '../utils/process-error.js';\n\ndeclare module '../expect.types' {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n interface ValueExpect<T> {\n /**\n * check if instance of value\n * @param constructor - The constructor function to check against\n */\n instanceOf(constructor: Constructor): this;\n }\n}\n\nuse({\n instanceOf: {\n type: 'method',\n value:\n ({ value, inverted }) =>\n (constructor: Constructor) => {\n if (inverted) {\n notInstanceOf(value, constructor);\n } else {\n instanceOf(value, constructor);\n }\n }\n }\n});\n","import { hasKeys, notHasKeys } from '../assert.js';\nimport { use } from '../mixins.js';\n\ntype InferMapKeys<T> = T extends Map<infer K, any> ? K : never;\n\ndeclare module '../expect.types' {\n interface ObjectExpect<T> {\n /**\n * Check if value has keys\n */\n keys<K extends keyof T>(keys: K[] | K): this;\n }\n interface MapExpect<T> {\n /**\n * Check if value has keys\n */\n keys<K extends InferMapKeys<T>>(keys: K[] | K): this;\n }\n}\n\nuse({\n keys: {\n type: 'method',\n value:\n ({ value, inverted }) =>\n (keys) => {\n if (inverted) {\n notHasKeys(value, keys);\n } else {\n hasKeys(value, keys);\n }\n }\n }\n});\n","import { hasSize, notHasSize } from '../assert.js';\nimport { use } from '../mixins.js';\n\ndeclare module '../expect.types' {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n interface ObjectExpect<T> {\n /**\n * check for object/array/Map/Set/string to have a certain size\n */\n sizeOf(size: number, message?: string): this;\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n interface MapExpect<T> {\n /**\n * check for Map to have a certain size\n */\n sizeOf(size: number, message?: string): this;\n }\n interface StringExpect {\n /**\n * check for string to have a certain size\n */\n lengthOf(length: number, message?: string): this;\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n interface ArrayExpect<T> {\n /**\n * check for array length\n */\n lengthOf(length: number, message?: string): this;\n }\n}\n\nuse({\n sizeOf: { type: 'alias', value: 'lengthOf' },\n lengthOf: {\n type: 'method',\n value:\n ({ value, inverted }) =>\n (length: number, message?: string) => {\n if (inverted) {\n notHasSize(value, length, message);\n } else {\n hasSize(value, length, message);\n }\n }\n }\n});\n","import { lessThanEqual, notLessThanEqual } from '../assert.js';\nimport { use } from '../mixins.js';\n\ndeclare module '../expect.types' {\n interface NumberExpect<T> {\n /**\n * check if actual is less than or equal to expected\n */\n lessThanOrEqual(value: T): this;\n /**\n * check if actual is less than or equal to expected\n */\n lte(value: T): this;\n /**\n * check if actual is less than or equal to expected\n */\n atMost(value: T): this;\n }\n interface DateExpect<T> {\n /**\n * check if actual is less than or equal to expected\n */\n lessThanOrEqual(value: T): this;\n /**\n * check if actual is less than or equal to expected\n */\n lte(value: T): this;\n /**\n * check if actual is less than or equal to expected\n */\n atMost(value: T): this;\n }\n}\n\nuse({\n lessThanOrEqual: {\n type: 'method',\n value:\n ({ value, inverted }) =>\n (other: any) => {\n if (inverted) {\n notLessThanEqual(value, other);\n } else {\n lessThanEqual(value, other);\n }\n }\n },\n lte: { type: 'alias', value: 'lessThanOrEqual' },\n atMost: { type: 'alias', value: 'lessThanOrEqual' }\n});\n","import { lessThan, notLessThan } from '../assert.js';\nimport { use } from '../mixins.js';\n\ndeclare module '../expect.types' {\n interface NumberExpect<T> {\n /**\n * check if actual is less than expected\n */\n lessThan(value: T): this;\n /**\n * check if actual is less than expected\n */\n lt(value: T): this;\n /**\n * check if actual is less than expected\n */\n below(value: T): this;\n }\n interface DateExpect<T> {\n /**\n * check if actual is less than expected\n */\n lessThan(value: T): this;\n /**\n * check if actual is less than expected\n */\n lt(value: T): this;\n /**\n * check if actual is less than expected\n */\n below(value: T): this;\n }\n}\n\nuse({\n lessThan: {\n type: 'method',\n value:\n ({ value, inverted }) =>\n (other: any) => {\n if (inverted) {\n notLessThan(value, other);\n } else {\n lessThan(value, other);\n }\n }\n },\n lt: { type: 'alias', value: 'lessThan' },\n below: { type: 'alias', value: 'lessThan' }\n});\n","import { match, notMatch } from '../assert.js';\nimport { use } from '../mixins.js';\n\ndeclare module '../expect.types' {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n interface StringExpect<T> {\n /**\n * check if string matches regex\n */\n match(regex: RegExp): this;\n }\n}\n\nuse({\n match: {\n type: 'method',\n value:\n ({ value, inverted }) =>\n (regex: RegExp) => {\n if (inverted) {\n notMatch(value, regex);\n } else {\n match(value, regex);\n }\n }\n }\n});\n","import { hasMembers, notHasMembers } from '../assert.js';\nimport { use } from '../mixins.js';\nimport { type DeepPartial } from '../utils/types.js';\n\ntype InferArray<T> = T extends Array<infer U> ? U : any;\n\ndeclare module '../expect.types' {\n interface ArrayExpect<T> {\n /**\n * check that the members in second array are present in the first one\n */\n members(value: InferArray<T>[], message?: string): this;\n same: ArrayExpect<T>;\n ordered: ArrayExpect<T>;\n /**\n * Use partial matching for objects\n * @example\n * expect({ a: 1, b: 2 }).to.partially.eql({ a: 1 });\n */\n partially: ArrayExpect<DeepPartial<T>>;\n }\n}\n\nuse({\n members: {\n type: 'method',\n value:\n ({ value, inverted, same, deep, ordered, partial }) =>\n (other: any, message?: string) => {\n if (inverted) {\n notHasMembers(value, other, { deep, same, ordered, partial }, message);\n } else {\n hasMembers(value, other, { deep, same, ordered, partial }, message);\n }\n }\n },\n same: {\n type: 'property',\n value: (state) => {\n state.same = true;\n return state;\n }\n },\n ordered: {\n type: 'property',\n value: (state) => {\n state.ordered = true;\n return state;\n }\n }\n});\n","import { notRejects, rejects } from '../assert.js';\nimport { type State, use } from '../mixins.js';\nimport { type Constructor, type ErrorPredicate } from '../utils/process-error.js';\n\ndeclare module '../expect.types' {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n interface PromiseExpect<T> {\n /**\n * check if promise rejects\n * @param message\n */\n reject(message?: string): Promise<void>;\n reject(matcher: RegExp | Constructor<Error> | ErrorPredicate): Promise<void>;\n }\n}\n\nuse({\n reject: {\n type: 'method',\n value:\n ({ value, inverted }: State<any>) =>\n (...args: any[]) => {\n return inverted ? notRejects(value, ...args) : rejects(value, ...args);\n }\n }\n});\n","import { notRoundTo, roundTo } from '../assert.js';\nimport { use } from '../mixins.js';\n\ndeclare module '../expect.types' {\n interface NumberExpect {\n /**\n * check if number close enough (default 10%)\n * @param target\n * @param decimal defaults to 0, can be negative if trying to round down to nearest 10, 100, etc\n */\n roundTo(target: number, decimal?: number): this;\n }\n}\n\nuse({\n roundTo: {\n type: 'method',\n value:\n ({ value, inverted }) =>\n (target, decimal = 0) => {\n if (inverted) {\n notRoundTo(value, target, decimal);\n } else {\n roundTo(value, target, decimal);\n }\n }\n }\n});\n","import { startsWith, notStartsWith } from '../assert.js';\nimport { use } from '../mixins.js';\n\ndeclare module '../expect.types' {\n interface StringExpect {\n /**\n * check if string starts with other string\n * @param start\n * @example startsWith('foo', 'f');\n */\n startWith(start: string): this;\n }\n}\n\nuse({\n startWith: {\n type: 'method',\n value:\n ({ value, inverted }) =>\n (start: string) => {\n if (inverted) {\n notStartsWith(value, start);\n } else {\n startsWith(value, start);\n }\n }\n }\n});\n","import { notThrows, throws } from '../assert.js';\nimport { type State, use } from '../mixins.js';\nimport { type Constructor, type ErrorPredicate } from '../utils/process-error.js';\n\ndeclare module '../expect.types' {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n interface FunctionExpect<T> {\n /**\n * check if function throws\n * @param message\n */\n throw(message?: string): this;\n throw(matcher: RegExp | Constructor<Error> | ErrorPredicate, message?: string): this;\n }\n}\n\nuse({\n throw: {\n type: 'method',\n value:\n ({ value, inverted }: State<any>) =>\n (...args: any[]) => {\n return inverted ? notThrows(value, ...args) : throws(value, ...args);\n }\n }\n});\n","import { isType, notIsType } from '../assert.js';\nimport { use } from '../mixins.js';\nimport { type ValueType } from '../utils/get-type.js';\n\ndeclare module '../expect.types' {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n interface NumberExpect<T> {\n /**\n * check if value is a number\n */\n number(): this;\n /**\n * check if value is a NaN\n */\n NaN(): this;\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n interface ArrayExpect<T> {\n /**\n * check if value is an array\n */\n array(): this;\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n interface BigIntExpect<T> {\n /**\n * check if value is a bigint\n */\n bigint(): this;\n }\n interface BooleanExpect {\n /**\n * check if value is a boolean\n */\n boolean(): this;\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n interface FunctionExpect<T> {\n /**\n * check if value is a function\n */\n function(): this;\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n interface ValueExpect<T> {\n /**\n * check if value is null\n */\n null(): this;\n /**\n * check if value is undefined\n */\n undefined(): this;\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n interface ObjectExpect<T> {\n /**\n * check if value is a plain object\n */\n object(): this;\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n interface StringExpect<T> {\n /**\n * check if value is a string\n */\n string(): this;\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n interface SymbolExpect<T> {\n /**\n * check if value is a symbol\n */\n symbol(): this;\n }\n}\n\nconst types: ValueType[] = [\n 'NaN',\n 'array',\n 'bigint',\n 'boolean',\n 'function',\n 'null',\n 'number',\n 'object',\n 'string',\n 'symbol',\n 'undefined'\n];\n\nuse(\n Object.fromEntries(\n types.map((type) => {\n return [\n type,\n {\n type: 'method',\n value:\n ({ value, inverted }) =>\n () => {\n if (inverted) {\n notIsType(value, type);\n } else {\n isType(value, type);\n }\n }\n }\n ];\n })\n )\n);\n","import { notIsType, isType } from '../assert.js';\nimport { use } from '../mixins.js';\nimport { type ValueType } from '../utils/get-type.js';\n\ndeclare module '../expect.types' {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n interface ValueExpect<T> {\n /**\n * check if value is of certain type\n */\n type(type: ValueType): this;\n }\n}\n\nuse({\n type: {\n type: 'method',\n value:\n ({ value, inverted }) =>\n (type: ValueType) => {\n if (inverted) {\n notIsType(value, type);\n } else {\n isType(value, type);\n }\n }\n }\n});\n","import { AssertionError } from 'hein-assertion-utils';\n\n/**\n * Throw an AssertionError\n * @param {string} message - The message to pass to the AssertionError\n */\nexport const fail = (message: string = 'Fail') => {\n throw new AssertionError(undefined, undefined, message);\n};\n","import { mixins, State, use } from './mixins.js';\nimport { registerMethod, registerProperty } from './utils/chain.js';\nimport { getSize } from './utils/get-size.js';\nimport { Expect } from './expect.types.js';\nimport './expect/after.js';\nimport './expect/ballpark.js';\nimport './expect/before.js';\nimport './expect/between.js';\nimport './expect/empty.js';\nimport './expect/end-with.js';\nimport './expect/eql.js';\nimport './expect/equal-shorthand.js';\nimport './expect/equal.js';\nimport './expect/excluding.js';\nimport './expect/greater-than-equal.js';\nimport './expect/greater-than.js';\nimport './expect/has-property.js';\nimport './expect/include.js';\nimport './expect/instance-of-shorthand.js';\nimport './expect/instance-of.js';\nimport './expect/keys.js';\nimport './expect/length.js';\nimport './expect/less-than-equal.js';\nimport './expect/less-than.js';\nimport './expect/match.js';\nimport './expect/members.js';\nimport './expect/reject.js';\nimport './expect/round-to.js';\nimport './expect/start-with.js';\nimport './expect/throw.js';\nimport './expect/type-shorthand.js';\nimport './expect/type.js';\nimport mapValues from 'lodash/mapValues.js';\nimport { fail } from './utils/fail.js';\n\nuse({\n to: { type: 'property', value: () => null },\n be: { type: 'property', value: () => null },\n a: { type: 'property', value: () => null },\n an: { type: 'property', value: () => null },\n and: {\n type: 'property',\n value: ({ value, every, ...rest }) => {\n const values = mapValues(rest, () => {}) as any;\n return { value, every, ...values };\n }\n },\n have: { type: 'property', value: () => null },\n in: { type: 'property', value: () => null },\n not: { type: 'property', value: (state) => ({ ...state, inverted: !state.inverted }) },\n of: { type: 'property', value: () => null },\n\n length: { type: 'property', value: (state) => ({ ...state, getProperty: getSize }) },\n deep: { type: 'property', value: (state) => ({ ...state, deep: true }) },\n\n every: { type: 'property', value: (state) => ({ ...state, every: true }) }\n});\n\nexport const expectChain = <T>(state: State<T>) => {\n const chain = {} as any;\n for (const [key, v] of Object.entries(mixins)) {\n const definition = v.type === 'alias' ? mixins[v.value] : v;\n if (definition.type === 'property') {\n registerProperty(chain, key, () => {\n const newState = definition.value(state);\n return expectChain({ ...state, ...newState });\n });\n } else if (definition.type === 'method') {\n registerMethod(chain, key, (...args: any[]) => {\n if (state.getProperty) {\n definition.value({ value: state.getProperty(state.value), inverted: state.inverted })(...args);\n } else if (state.every) {\n for (const value of state.value as any) {\n definition.value({ ...state, value })(...args);\n }\n } else {\n const result = definition.value({ ...state })(...args);\n if (result as any) {\n return result;\n }\n }\n return expectChain(state);\n });\n }\n }\n return chain;\n};\n\nexport const expect = (<T>(actual: T) => {\n return expectChain({ value: actual });\n}) as Expect;\n\nexpect.fail = fail;\n"],"mappings":";;;;;;;AA6BA,MAAaA,SAAoD,EAAE;AAEnE,MAAa,OAAO,YAAuD;AACvE,QAAO,OAAO,QAAQ,QAAQ;;;;;AChClC,MAAa,oBAA8D,QAAW,MAAS,UAAa;AACxG,QAAO,eAAe,QAAQ,MAAM;EAChC,YAAY;EACZ,MAAM;AACF,UAAO,OAAO;;EAErB,CAAC;AACF,QAAO;;AAGX,MAAa,kBAA0C,QAAW,MAAS,UAAa;AACpF,QAAO,eAAe,QAAQ,MAAM,EAChC,OACH,CAAC;AACF,QAAO;;;;;ACZX,MAAa,WAAW,UAAe;AACnC,KAAI,MAAM,QAAQ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,OAAO,WAAW;GAC/B,MAAM,WAAW,WAAW,MAAM,MAAM;AACxC,UAAO,YAAY;IAAE,GAAG;IAAO,GAAG;IAAU,CAAC;IAC/C;WACK,WAAW,SAAS,SAC3B,gBAAe,OAAO,MAAM,GAAG,SAAgB;AAC3C,OAAI,MAAM,YACN,YAAW,MAAM;IAAE,OAAO,MAAM,YAAY,MAAM,MAAM;IAAE,UAAU,MAAM;IAAU,CAAC,CAAC,GAAG,KAAK;YACvF,MAAM,MACb,MAAK,MAAM,SAAS,MAAM,MACtB,YAAW,MAAM;IAAE,GAAG;IAAO;IAAO,CAAC,CAAC,GAAG,KAAK;QAE/C;IACH,MAAM,SAAS,WAAW,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC,GAAG,KAAK;AACtD,QAAI,OACA,QAAO;;AAGf,UAAO,YAAY,MAAM;IAC3B;;AAGV,QAAO;;AAGX,MAAa,WAAc,WAAc;AACrC,QAAO,YAAY,EAAE,OAAO,QAAQ,CAAC;;AAGzC,OAAO,OAAO"}
@@ -0,0 +1,42 @@
1
+ import "hein-assertion-utils";
2
+
3
+ //#region src/utils/process-error.d.ts
4
+ interface Constructor<T = any> {
5
+ new (...args: any[]): T;
6
+ }
7
+ type ErrorPredicate = (error: Error) => boolean;
8
+ //#endregion
9
+ //#region src/assert/throws.d.ts
10
+ type ThrowsCallback = () => unknown;
11
+ interface Throw {
12
+ /**
13
+ * check if function throws an error
14
+ * @param callback
15
+ * @example throws(() => { throw new Error('foo'); });
16
+ * @example throws(() => { throw new TypeError('foo'); }, TypeError);
17
+ */
18
+ (callback: ThrowsCallback, message?: string): void;
19
+ /**
20
+ * check if function throws an error matching the constructor
21
+ * @param callback
22
+ * @example throws(() => { throw new TypeError('foo'); }, TypeError);
23
+ */
24
+ (callback: ThrowsCallback, expectedError: Constructor, message?: string): void;
25
+ /**
26
+ * check if function throws an error matching the regex
27
+ * @param callback
28
+ * @example throws(() => { throw new Error('foo'); });
29
+ * @example throws(() => { throw new TypeError('foo'); }, /foo/);
30
+ */
31
+ (callback: ThrowsCallback, expectedError: RegExp, message?: string): void;
32
+ /**
33
+ * check if function throws an error matching the predicate function
34
+ * @param callback
35
+ * @example throws(() => { throw new TypeError('foo'); }, (error) => error.message === 'foo');
36
+ */
37
+ (callback: ThrowsCallback, expectedError: ErrorPredicate, message?: string): void;
38
+ }
39
+ declare const throws: Throw, notThrows: Throw;
40
+ //#endregion
41
+ export { Constructor, ErrorPredicate, ThrowsCallback, notThrows, throws };
42
+ //# sourceMappingURL=throws-BrCCeBBl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"throws-BrCCeBBl.d.ts","names":[],"sources":["../src/utils/process-error.ts","../src/assert/throws.ts"],"sourcesContent":[],"mappings":";;;UAEiB;wBACS;AAD1B;AAIY,KAAA,cAAA,GAAc,CAAA,KAAW,EAAA,KAAK,EAAA,GAAA,OAAA;;;KCF9B,cAAA;UAEF,KAAA;EDJO;AAIjB;;;;ACFA;EAEU,CAAA,QAAK,EAOA,cAPA,EAAA,OAAA,CAAA,EAAA,MAAA,CAAA,EAAA,IAAA;EAAA;;;;;WAoB+B,EAP/B,cAO+B,EAAA,aAAA,EAPA,WAOA,EAAA,OAAA,CAAA,EAAA,MAAA,CAAA,EAAA,IAAA;;;;AAqB9C;;;WAA+B,EArBhB,cAqBgB,EAAA,aAAA,EArBe,MAqBf,EAAA,OAAA,CAAA,EAAA,MAAA,CAAA,EAAA,IAAA;EAoB7B;;;;;aAnCa,+BAA+B;;cAehC,QAAM,kBAAW"}
@@ -0,0 +1,40 @@
1
+ //#region src/utils/process-error.d.ts
2
+ interface Constructor<T = any> {
3
+ new (...args: any[]): T;
4
+ }
5
+ type ErrorPredicate = (error: Error) => boolean;
6
+ //#endregion
7
+ //#region src/assert/throws.d.ts
8
+ type ThrowsCallback = () => unknown;
9
+ interface Throw {
10
+ /**
11
+ * check if function throws an error
12
+ * @param callback
13
+ * @example throws(() => { throw new Error('foo'); });
14
+ * @example throws(() => { throw new TypeError('foo'); }, TypeError);
15
+ */
16
+ (callback: ThrowsCallback, message?: string): void;
17
+ /**
18
+ * check if function throws an error matching the constructor
19
+ * @param callback
20
+ * @example throws(() => { throw new TypeError('foo'); }, TypeError);
21
+ */
22
+ (callback: ThrowsCallback, expectedError: Constructor, message?: string): void;
23
+ /**
24
+ * check if function throws an error matching the regex
25
+ * @param callback
26
+ * @example throws(() => { throw new Error('foo'); });
27
+ * @example throws(() => { throw new TypeError('foo'); }, /foo/);
28
+ */
29
+ (callback: ThrowsCallback, expectedError: RegExp, message?: string): void;
30
+ /**
31
+ * check if function throws an error matching the predicate function
32
+ * @param callback
33
+ * @example throws(() => { throw new TypeError('foo'); }, (error) => error.message === 'foo');
34
+ */
35
+ (callback: ThrowsCallback, expectedError: ErrorPredicate, message?: string): void;
36
+ }
37
+ declare const throws: Throw, notThrows: Throw;
38
+ //#endregion
39
+ export { Constructor, ErrorPredicate, ThrowsCallback, notThrows, throws };
40
+ //# sourceMappingURL=throws-D7JsW4NM.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"throws-D7JsW4NM.d.cts","names":[],"sources":["../src/utils/process-error.ts","../src/assert/throws.ts"],"sourcesContent":[],"mappings":";AAEiB,UAAA,WAAW,CACF,IAAC,GAAA,CAAA,CAAA;EAGf,KAAA,GAAA,IAAA,EAAA,GAAc,EAAA,CAAA,EAHA,CAGA;;KAAd,cAAA,WAAyB;;;AAJpB,KCEL,cAAA,GDDc,GAAC,GAAA,OAAA;AAG3B,UCAU,KAAA,CDAE;;;;ACFZ;AAA2C;;WAS5B,EAAA,cAAA,EAAA,OAAA,CAAA,EAAA,MAAA,CAAA,EAAA,IAAA;;;;;;WAmB+B,EAb/B,cAa+B,EAAA,aAAA,EAbA,WAaA,EAAA,OAAA,CAAA,EAAA,MAAA,CAAA,EAAA,IAAA;EAAc;AAe5D;;;;;EAAsB,CAAA,QAAA,EArBP,cAqBO,EAAA,aAAA,EArBwB,MAqBxB,EAAA,OAAA,CAAA,EAAA,MAAA,CAAA,EAAA,IAAA;;;;;;aAfP,+BAA+B;;cAehC,QAAM,kBAAW"}
@@ -0,0 +1,13 @@
1
+ import eslintConfigHein from 'eslint-config-hein';
2
+ import { globalIgnores } from 'eslint/config';
3
+
4
+ export default [
5
+ globalIgnores(['tsdown.config.ts']),
6
+ ...eslintConfigHein,
7
+ {
8
+ files: ['src/expect.types.ts'],
9
+ rules: {
10
+ '@typescript-eslint/no-empty-object-type': 'off'
11
+ }
12
+ }
13
+ ];
package/package.json CHANGED
@@ -1,6 +1,8 @@
1
1
  {
2
2
  "name": "hein",
3
- "version": "1.4.2",
3
+ "description": "Assertion library written in TypeScript",
4
+ "version": "2.0.0-alpha.0",
5
+ "type": "module",
4
6
  "engines": {
5
7
  "node": ">=14.0.0"
6
8
  },
@@ -9,7 +11,6 @@
9
11
  "url": "https://github.com/KristjanTammekivi/hein"
10
12
  },
11
13
  "homepage": "https://heinjs.com",
12
- "description": "Assertion library written in TypeScript",
13
14
  "keywords": [
14
15
  "typescript",
15
16
  "assertion",
@@ -17,11 +18,23 @@
17
18
  "test",
18
19
  "testing"
19
20
  ],
20
- "main": "dist/index.js",
21
+ "main": "dist/index.cjs",
22
+ "module": "dist/index.js",
23
+ "types": "dist/index.d.cts",
21
24
  "exports": {
22
- ".": "./dist/index.js",
23
- "./assert": "./dist/assert.js",
24
- "./expect.types": "./dist/expect.types.js"
25
+ ".": {
26
+ "import": "./dist/index.js",
27
+ "require": "./dist/index.cjs"
28
+ },
29
+ "./assert": {
30
+ "import": "./dist/assert.js",
31
+ "require": "./dist/assert.cjs"
32
+ },
33
+ "./expect.types": {
34
+ "import": "./dist/expect.types.js",
35
+ "require": "./dist/expect.types.cjs"
36
+ },
37
+ "./package.json": "./package.json"
25
38
  },
26
39
  "typesVersions": {
27
40
  "*": {
@@ -34,7 +47,7 @@
34
47
  }
35
48
  },
36
49
  "scripts": {
37
- "build": "rimraf dist && tsc -b .",
50
+ "build": "tsdown",
38
51
  "lint": "eslint src/**/*.ts",
39
52
  "lint:fix": "npm run lint -- --fix",
40
53
  "test": "node --trace-warnings node_modules/.bin/mocha 'src/**/*.test.ts'",
@@ -45,22 +58,22 @@
45
58
  "author": "Kristjan Tammekivi",
46
59
  "license": "MIT",
47
60
  "dependencies": {
48
- "hein-assertion-utils": "^1.0.4",
61
+ "hein-assertion-utils": "^2.0.0-alpha.3",
49
62
  "lodash": "^4.17.21"
50
63
  },
51
64
  "devDependencies": {
52
- "@types/lodash": "^4.14.184",
53
- "@types/mocha": "^10.0.0",
54
- "@types/mustache": "^4.2.1",
55
- "@types/node": "^20.10.0",
56
- "eslint": "^8.55.0",
57
- "eslint-config-hein": "^1.0.4",
58
- "mocha": "^10.1.0",
59
- "nyc": "^15.1.0",
65
+ "@types/lodash": "^4.17.0",
66
+ "@types/mocha": "^10.0.9",
67
+ "@types/node": "^24.5.0",
68
+ "eslint": "^9.35.0",
69
+ "eslint-config-hein": "^2.0.0-alpha.0",
70
+ "mocha": "^11.7.1",
71
+ "nyc": "^17.1.0",
60
72
  "rimraf": "^5.0.1",
61
73
  "source-map-support": "^0.5.21",
62
74
  "ts-node": "^10.9.1",
63
- "typedoc": "^0.25.0",
64
- "typescript": "^5.2.2"
75
+ "tsdown": "^0.15.2",
76
+ "typedoc": "^0.28.9",
77
+ "typescript": "^5.9.2"
65
78
  }
66
79
  }
@@ -0,0 +1,9 @@
1
+ import { defineConfig } from 'tsdown';
2
+
3
+ export default defineConfig([{
4
+ entry: ['src/index.ts', 'src/expect.types.ts', 'src/assert.ts'],
5
+ platform: 'node',
6
+ format: ['esm', 'cjs'],
7
+ sourcemap: true,
8
+ dts: true
9
+ }]);
@@ -1,2 +0,0 @@
1
- export declare const deepEqual: <T>(actual: T, expected: T, partialOrMessage?: string | boolean, message?: string) => true | void, notDeepEqual: <T>(actual: T, expected: T, partialOrMessage?: string | boolean, message?: string) => true | void;
2
- //# sourceMappingURL=deep-equal.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"deep-equal.d.ts","sourceRoot":"","sources":["../../src/assert/deep-equal.ts"],"names":[],"mappings":"AAIA,eAAO,MAAO,SAAS,iDAO+B,MAAM,GAAG,OAAO,YAAoB,MAAM,kBAPvE,YAAY,iDAOiB,MAAM,GAAG,OAAO,YAAoB,MAAM,gBAY9F,CAAC"}
@@ -1,26 +0,0 @@
1
- "use strict";
2
- var _a;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.notDeepEqual = exports.deepEqual = void 0;
5
- const lodash_1 = require("lodash");
6
- const hein_assertion_utils_1 = require("hein-assertion-utils");
7
- const match_1 = require("../utils/match");
8
- _a = (0, hein_assertion_utils_1.createAssertion)({
9
- messages: {
10
- notEql: 'Expected {{actual}} to deep equal {{expected}}',
11
- not: 'Expected {{actual}} to not deep equal {{expected}}'
12
- },
13
- test: (report) => (actual, expected, partialOrMessage = false, message) => {
14
- const partial = typeof partialOrMessage === 'boolean' ? partialOrMessage : false;
15
- message = typeof partialOrMessage === 'string' ? partialOrMessage : message;
16
- if (typeof expected !== 'function') {
17
- // TODO: evaluations
18
- expected = (0, lodash_1.cloneDeep)(expected);
19
- }
20
- if ((0, match_1.match)(actual, expected, { mutate: true, partial })) {
21
- return report({ message, status: 'ok', expected, actual });
22
- }
23
- return report({ message, status: 'notok', messageId: 'notEql', expected, actual });
24
- }
25
- }), exports.deepEqual = _a[0], exports.notDeepEqual = _a[1];
26
- //# sourceMappingURL=deep-equal.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"deep-equal.js","sourceRoot":"","sources":["../../src/assert/deep-equal.ts"],"names":[],"mappings":";;;;AAAA,mCAAmC;AACnC,+DAAuD;AACvD,0CAAuC;AAE1B,KAA4B,IAAA,sCAAe,EAAC;IACrD,QAAQ,EAAE;QACN,MAAM,EAAE,gDAAgD;QACxD,GAAG,EAAE,oDAAoD;KAC5D;IACD,IAAI,EACA,CAAC,MAAM,EAAE,EAAE,CACX,CAAI,MAAS,EAAE,QAAW,EAAE,mBAAqC,KAAK,EAAE,OAAgB,EAAE,EAAE;QACxF,MAAM,OAAO,GAAG,OAAO,gBAAgB,KAAK,SAAS,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,KAAK,CAAC;QACjF,OAAO,GAAG,OAAO,gBAAgB,KAAK,QAAQ,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,OAAO,CAAC;QAC5E,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE;YAChC,oBAAoB;YACpB,QAAQ,GAAG,IAAA,kBAAS,EAAC,QAAQ,CAAC,CAAC;SAClC;QACD,IAAI,IAAA,aAAK,EAAC,MAAM,EAAE,QAAQ,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE;YACpD,OAAO,MAAM,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;SAC9D;QACD,OAAO,MAAM,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;IACvF,CAAC;CACR,CAAC,EAnBY,iBAAS,UAAE,oBAAY,SAmBlC"}
@@ -1,20 +0,0 @@
1
- interface DeepHasProperty {
2
- /**
3
- * check if object has a property
4
- * @param object
5
- * @param property a property in the object. Can be a path like 'a.b.c'
6
- * @example deepHasProperty([{a: {b: {c: 1}}}], '[0].a.b.c');
7
- */
8
- (object: any, property: string): void;
9
- /**
10
- * check if object has a property with a specific value
11
- * @param object
12
- * @param property a property in the object. Can be a path like 'a.b.c'
13
- * @param value
14
- * @example deepHasProperty([{a: {b: {c: 1}}}], '[0].a.b.c', 1);
15
- */
16
- (object: any, property: string, value: any): void;
17
- }
18
- export declare const deepHasProperty: DeepHasProperty, deepNotHasProperty: DeepHasProperty;
19
- export {};
20
- //# sourceMappingURL=deep-has-property.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"deep-has-property.d.ts","sourceRoot":"","sources":["../../src/assert/deep-has-property.ts"],"names":[],"mappings":"AAGA,UAAU,eAAe;IACrB;;;;;OAKG;IACH,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC;;;;;;OAMG;IACH,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI,CAAC;CACrD;AAED,eAAO,MAAO,eAAe,mBAAE,kBAAkB,iBA4C/C,CAAC"}
@@ -1,50 +0,0 @@
1
- "use strict";
2
- var _a;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.deepNotHasProperty = exports.deepHasProperty = void 0;
5
- const hein_assertion_utils_1 = require("hein-assertion-utils");
6
- const lodash_1 = require("lodash");
7
- _a = (0, hein_assertion_utils_1.createAssertion)({
8
- messages: {
9
- noProperty: 'Expected {{actual}} to have property {{expected}}',
10
- wrongValue: 'Expected {{obj}} to have property {{expected}} with value {{value}}',
11
- not: 'Expected {{actual}} to not have property {{expected}}',
12
- notWrongValue: 'Expected {{obj}} to not have property {{expected}} with value {{value}}'
13
- },
14
- test: (report) => (...args) => {
15
- const [actual, expected, value] = args;
16
- const actualStringified = (0, hein_assertion_utils_1.stringify)(actual);
17
- if ((0, lodash_1.has)(actual, expected)) {
18
- if (args.length === 3) {
19
- const actualValue = (0, lodash_1.get)(actual, expected);
20
- if (actualValue === value) {
21
- return report({
22
- status: 'ok',
23
- messageId: 'notWrongValue',
24
- expected: value,
25
- actual: actualValue,
26
- data: { value, expected, obj: actualStringified },
27
- noStringify: true
28
- });
29
- }
30
- return report({
31
- status: 'notok',
32
- messageId: 'wrongValue',
33
- expected: value,
34
- actual: actualValue,
35
- data: { value, expected, obj: actualStringified },
36
- noStringify: true
37
- });
38
- }
39
- return report({ status: 'ok', noStringify: true, expected, actual: actualStringified });
40
- }
41
- return report({
42
- status: 'notok',
43
- messageId: 'noProperty',
44
- expected,
45
- actual: actualStringified,
46
- noStringify: true
47
- });
48
- }
49
- }), exports.deepHasProperty = _a[0], exports.deepNotHasProperty = _a[1];
50
- //# sourceMappingURL=deep-has-property.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"deep-has-property.js","sourceRoot":"","sources":["../../src/assert/deep-has-property.ts"],"names":[],"mappings":";;;;AAAA,+DAAkE;AAClE,mCAAkC;AAoBrB,KAAwC,IAAA,sCAAe,EAAC;IACjE,QAAQ,EAAE;QACN,UAAU,EAAE,mDAAmD;QAC/D,UAAU,EAAE,qEAAqE;QACjF,GAAG,EAAE,uDAAuD;QAC5D,aAAa,EAAE,yEAAyE;KAC3F;IACD,IAAI,EACA,CAAC,MAAM,EAAmB,EAAE,CAC5B,CAAC,GAAG,IAAkD,EAAE,EAAE;QACtD,MAAM,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAC,GAAG,IAAI,CAAC;QACvC,MAAM,iBAAiB,GAAG,IAAA,gCAAS,EAAC,MAAM,CAAC,CAAC;QAC5C,IAAI,IAAA,YAAG,EAAC,MAAM,EAAE,QAAQ,CAAC,EAAE;YACvB,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;gBACnB,MAAM,WAAW,GAAG,IAAA,YAAG,EAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;gBAC1C,IAAI,WAAW,KAAK,KAAK,EAAE;oBACvB,OAAO,MAAM,CAAC;wBACV,MAAM,EAAE,IAAI;wBACZ,SAAS,EAAE,eAAe;wBAC1B,QAAQ,EAAE,KAAK;wBACf,MAAM,EAAE,WAAW;wBACnB,IAAI,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,iBAAiB,EAAE;wBACjD,WAAW,EAAE,IAAI;qBACpB,CAAC,CAAC;iBACN;gBACD,OAAO,MAAM,CAAC;oBACV,MAAM,EAAE,OAAO;oBACf,SAAS,EAAE,YAAY;oBACvB,QAAQ,EAAE,KAAK;oBACf,MAAM,EAAE,WAAW;oBACnB,IAAI,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,iBAAiB,EAAE;oBACjD,WAAW,EAAE,IAAI;iBACpB,CAAC,CAAC;aACN;YACD,OAAO,MAAM,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAAC,CAAC;SAC3F;QACD,OAAO,MAAM,CAAC;YACV,MAAM,EAAE,OAAO;YACf,SAAS,EAAE,YAAY;YACvB,QAAQ;YACR,MAAM,EAAE,iBAAiB;YACzB,WAAW,EAAE,IAAI;SACpB,CAAC,CAAC;IACP,CAAC;CACR,CAAC,EA5CY,uBAAe,UAAE,0BAAkB,SA4C9C"}
@@ -1,11 +0,0 @@
1
- interface EndsWith {
2
- /**
3
- * check if string ends with a specific string
4
- * @param string
5
- * @param end
6
- */
7
- (string: string, end: string): void;
8
- }
9
- export declare const endsWith: EndsWith, notEndsWith: EndsWith;
10
- export {};
11
- //# sourceMappingURL=ends-with.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ends-with.d.ts","sourceRoot":"","sources":["../../src/assert/ends-with.ts"],"names":[],"mappings":"AAIA,UAAU,QAAQ;IACd;;;;OAIG;IACH,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CACvC;AAED,eAAO,MAAO,QAAQ,YAAE,WAAW,UAwBjC,CAAC"}
@@ -1,30 +0,0 @@
1
- "use strict";
2
- var _a;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.notEndsWith = exports.endsWith = void 0;
5
- const hein_assertion_utils_1 = require("hein-assertion-utils");
6
- _a = (0, hein_assertion_utils_1.createAssertion)({
7
- messages: {
8
- wrongEnd: 'Expected {{ actual }} to end with {{ expected }}',
9
- not: 'Expected {{ actual }} to not end with {{ expected }}'
10
- },
11
- test: (report) => (actual, end) => {
12
- if (actual.endsWith(end)) {
13
- report({
14
- messageId: 'not',
15
- status: 'ok',
16
- actual,
17
- expected: end
18
- });
19
- }
20
- else {
21
- report({
22
- messageId: 'wrongEnd',
23
- status: 'notok',
24
- actual,
25
- expected: end
26
- });
27
- }
28
- }
29
- }), exports.endsWith = _a[0], exports.notEndsWith = _a[1];
30
- //# sourceMappingURL=ends-with.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ends-with.js","sourceRoot":"","sources":["../../src/assert/ends-with.ts"],"names":[],"mappings":";;;;AAAA,+DAAuD;AAa1C,KAA0B,IAAA,sCAAe,EAAC;IACnD,QAAQ,EAAE;QACN,QAAQ,EAAE,kDAAkD;QAC5D,GAAG,EAAE,sDAAsD;KAC9D;IACD,IAAI,EACA,CAAC,MAAM,EAAY,EAAE,CACrB,CAAC,MAAc,EAAE,GAAW,EAAE,EAAE;QAC5B,IAAI,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;YACtB,MAAM,CAAC;gBACH,SAAS,EAAE,KAAK;gBAChB,MAAM,EAAE,IAAI;gBACZ,MAAM;gBACN,QAAQ,EAAE,GAAG;aAChB,CAAC,CAAC;SACN;aAAM;YACH,MAAM,CAAC;gBACH,SAAS,EAAE,UAAU;gBACrB,MAAM,EAAE,OAAO;gBACf,MAAM;gBACN,QAAQ,EAAE,GAAG;aAChB,CAAC,CAAC;SACN;IACL,CAAC;CACR,CAAC,EAxBY,gBAAQ,UAAE,mBAAW,SAwBhC"}
@@ -1,9 +0,0 @@
1
- interface Equal {
2
- /**
3
- * check for === equality except here NaN is equal to NaN
4
- */
5
- <T>(actual: T, expected: T, message?: string): void;
6
- }
7
- export declare const equal: Equal, notEqual: Equal;
8
- export {};
9
- //# sourceMappingURL=equal.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"equal.d.ts","sourceRoot":"","sources":["../../src/assert/equal.ts"],"names":[],"mappings":"AAEA,UAAU,KAAK;IACX;;OAEG;IACH,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvD;AAED,eAAO,MAAO,KAAK,SAAE,QAAQ,OAgB3B,CAAC"}
@@ -1,21 +0,0 @@
1
- "use strict";
2
- var _a;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.notEqual = exports.equal = void 0;
5
- const hein_assertion_utils_1 = require("hein-assertion-utils");
6
- _a = (0, hein_assertion_utils_1.createAssertion)({
7
- messages: {
8
- equal: 'Expected {{actual}} to equal {{expected}}',
9
- not: 'Expected {{actual}} to not equal {{expected}}'
10
- },
11
- test: (report) => (a, b, message) => {
12
- if (Number.isNaN(a) && Number.isNaN(b)) {
13
- return report({ status: 'ok', expected: b, actual: a, message });
14
- }
15
- if (a !== b) {
16
- return report({ status: 'notok', messageId: 'equal', actual: a, expected: b, message });
17
- }
18
- return report({ status: 'ok', expected: a, actual: b, message });
19
- }
20
- }), exports.equal = _a[0], exports.notEqual = _a[1];
21
- //# sourceMappingURL=equal.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"equal.js","sourceRoot":"","sources":["../../src/assert/equal.ts"],"names":[],"mappings":";;;;AAAA,+DAAuD;AAS1C,KAAoB,IAAA,sCAAe,EAAC;IAC7C,QAAQ,EAAE;QACN,KAAK,EAAE,2CAA2C;QAClD,GAAG,EAAE,+CAA+C;KACvD;IACD,IAAI,EACA,CAAC,MAAM,EAAS,EAAE,CAClB,CAAI,CAAI,EAAE,CAAI,EAAE,OAAgB,EAAE,EAAE;QAChC,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;YACpC,OAAO,MAAM,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;SACpE;QACD,IAAI,CAAC,KAAK,CAAC,EAAE;YACT,OAAO,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;SAC3F;QACD,OAAO,MAAM,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;IACrE,CAAC;CACR,CAAC,EAhBY,aAAK,UAAE,gBAAQ,SAgB1B"}
@@ -1,9 +0,0 @@
1
- interface GreaterThanEqual {
2
- /**
3
- * check for >=
4
- */
5
- <T extends number | bigint | Date>(actual: T, expected: T, message?: string): void;
6
- }
7
- export declare const greaterThanEqual: GreaterThanEqual, notGreaterThanEqual: GreaterThanEqual;
8
- export {};
9
- //# sourceMappingURL=greater-than-equal.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"greater-than-equal.d.ts","sourceRoot":"","sources":["../../src/assert/greater-than-equal.ts"],"names":[],"mappings":"AAGA,UAAU,gBAAgB;IACtB;;OAEG;IACH,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACtF;AAED,eAAO,MAAO,gBAAgB,oBAAE,mBAAmB,kBAcjD,CAAC"}
@@ -1,20 +0,0 @@
1
- "use strict";
2
- var _a;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.notGreaterThanEqual = exports.greaterThanEqual = void 0;
5
- const hein_assertion_utils_1 = require("hein-assertion-utils");
6
- const validate_numeric_and_dates_1 = require("../utils/validate-numeric-and-dates");
7
- _a = (0, hein_assertion_utils_1.createAssertion)({
8
- messages: {
9
- notGreaterThanEqual: 'Expected {{actual}} to not be greater than or equal to {{expected}}',
10
- not: 'Expected {{actual}} to not be greater than or equal to {{expected}}'
11
- },
12
- test: (report) => (a, b, message) => {
13
- (0, validate_numeric_and_dates_1.validateNumericsAndDates)(a, b);
14
- if (a < b) {
15
- return report({ status: 'notok', messageId: 'notGreaterThanEqual', actual: a, expected: b, message });
16
- }
17
- return report({ status: 'ok', expected: a, actual: b });
18
- }
19
- }), exports.greaterThanEqual = _a[0], exports.notGreaterThanEqual = _a[1];
20
- //# sourceMappingURL=greater-than-equal.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"greater-than-equal.js","sourceRoot":"","sources":["../../src/assert/greater-than-equal.ts"],"names":[],"mappings":";;;;AAAA,+DAAuD;AACvD,oFAA+E;AASlE,KAA0C,IAAA,sCAAe,EAAC;IACnE,QAAQ,EAAE;QACN,mBAAmB,EAAE,qEAAqE;QAC1F,GAAG,EAAE,qEAAqE;KAC7E;IACD,IAAI,EACA,CAAC,MAAM,EAAoB,EAAE,CAC7B,CAAC,CAAM,EAAE,CAAM,EAAE,OAAgB,EAAE,EAAE;QACjC,IAAA,qDAAwB,EAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAC/B,IAAI,CAAC,GAAG,CAAC,EAAE;YACP,OAAO,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,qBAAqB,EAAE,MAAM,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;SACzG;QACD,OAAO,MAAM,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;IAC5D,CAAC;CACR,CAAC,EAdY,wBAAgB,UAAE,2BAAmB,SAchD"}
@@ -1,9 +0,0 @@
1
- interface GreaterThan {
2
- /**
3
- * check for >
4
- */
5
- <T extends number | bigint | Date>(actual: T, expected: T, message?: string): void;
6
- }
7
- export declare const greaterThan: GreaterThan, notGreaterThan: GreaterThan;
8
- export {};
9
- //# sourceMappingURL=greater-than.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"greater-than.d.ts","sourceRoot":"","sources":["../../src/assert/greater-than.ts"],"names":[],"mappings":"AAGA,UAAU,WAAW;IACjB;;OAEG;IACH,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACtF;AAED,eAAO,MAAO,WAAW,eAAE,cAAc,aAcvC,CAAC"}
@@ -1,20 +0,0 @@
1
- "use strict";
2
- var _a;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.notGreaterThan = exports.greaterThan = void 0;
5
- const hein_assertion_utils_1 = require("hein-assertion-utils");
6
- const validate_numeric_and_dates_1 = require("../utils/validate-numeric-and-dates");
7
- _a = (0, hein_assertion_utils_1.createAssertion)({
8
- messages: {
9
- smaller: 'Expected {{actual}} to be greater than {{expected}}',
10
- not: 'Expected {{actual}} to not be greater than {{expected}}'
11
- },
12
- test: (report) => (actual, expected) => {
13
- (0, validate_numeric_and_dates_1.validateNumericsAndDates)(actual, expected);
14
- if (actual > expected) {
15
- return report({ status: 'ok', messageId: 'not', expected, actual });
16
- }
17
- return report({ status: 'notok', messageId: 'smaller', actual, expected, noStringify: true });
18
- }
19
- }), exports.greaterThan = _a[0], exports.notGreaterThan = _a[1];
20
- //# sourceMappingURL=greater-than.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"greater-than.js","sourceRoot":"","sources":["../../src/assert/greater-than.ts"],"names":[],"mappings":";;;;AAAA,+DAAuD;AACvD,oFAA+E;AASlE,KAAgC,IAAA,sCAAe,EAAC;IACzD,QAAQ,EAAE;QACN,OAAO,EAAE,qDAAqD;QAC9D,GAAG,EAAE,yDAAyD;KACjE;IACD,IAAI,EACA,CAAC,MAAM,EAAe,EAAE,CACxB,CAAC,MAAW,EAAE,QAAa,EAAE,EAAE;QAC3B,IAAA,qDAAwB,EAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAC3C,IAAI,MAAM,GAAG,QAAQ,EAAE;YACnB,OAAO,MAAM,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;SACvE;QACD,OAAO,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;IAClG,CAAC;CACR,CAAC,EAdY,mBAAW,UAAE,sBAAc,SActC"}