hein 2.0.0-alpha.1 → 2.0.0-alpha.3
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.
- package/dist/_virtual/rolldown_runtime.cjs +34 -0
- package/dist/assert/deep-equal.cjs +40 -0
- package/dist/assert/deep-equal.cjs.map +1 -0
- package/dist/assert/deep-equal.d.cts +5 -0
- package/dist/assert/deep-equal.d.cts.map +1 -0
- package/dist/assert/deep-equal.d.ts +5 -0
- package/dist/assert/deep-equal.d.ts.map +1 -0
- package/dist/assert/deep-equal.js +36 -0
- package/dist/assert/deep-equal.js.map +1 -0
- package/dist/assert/deep-has-property.cjs +68 -0
- package/dist/assert/deep-has-property.cjs.map +1 -0
- package/dist/assert/deep-has-property.d.cts +22 -0
- package/dist/assert/deep-has-property.d.cts.map +1 -0
- package/dist/assert/deep-has-property.d.ts +22 -0
- package/dist/assert/deep-has-property.d.ts.map +1 -0
- package/dist/assert/deep-has-property.js +63 -0
- package/dist/assert/deep-has-property.js.map +1 -0
- package/dist/assert/ends-with.cjs +30 -0
- package/dist/assert/ends-with.cjs.map +1 -0
- package/dist/assert/ends-with.d.cts +13 -0
- package/dist/assert/ends-with.d.cts.map +1 -0
- package/dist/assert/ends-with.d.ts +13 -0
- package/dist/assert/ends-with.d.ts.map +1 -0
- package/dist/assert/ends-with.js +27 -0
- package/dist/assert/ends-with.js.map +1 -0
- package/dist/assert/equal.cjs +37 -0
- package/dist/assert/equal.cjs.map +1 -0
- package/dist/assert/equal.d.cts +11 -0
- package/dist/assert/equal.d.cts.map +1 -0
- package/dist/assert/equal.d.ts +11 -0
- package/dist/assert/equal.d.ts.map +1 -0
- package/dist/assert/equal.js +34 -0
- package/dist/assert/equal.js.map +1 -0
- package/dist/assert/greater-than-equal.cjs +32 -0
- package/dist/assert/greater-than-equal.cjs.map +1 -0
- package/dist/assert/greater-than-equal.d.cts +11 -0
- package/dist/assert/greater-than-equal.d.cts.map +1 -0
- package/dist/assert/greater-than-equal.d.ts +11 -0
- package/dist/assert/greater-than-equal.d.ts.map +1 -0
- package/dist/assert/greater-than-equal.js +29 -0
- package/dist/assert/greater-than-equal.js.map +1 -0
- package/dist/assert/greater-than.cjs +33 -0
- package/dist/assert/greater-than.cjs.map +1 -0
- package/dist/assert/greater-than.d.cts +11 -0
- package/dist/assert/greater-than.d.cts.map +1 -0
- package/dist/assert/greater-than.d.ts +11 -0
- package/dist/assert/greater-than.d.ts.map +1 -0
- package/dist/assert/greater-than.js +30 -0
- package/dist/assert/greater-than.js.map +1 -0
- package/dist/assert/has-keys.cjs +58 -0
- package/dist/assert/has-keys.cjs.map +1 -0
- package/dist/assert/has-keys.d.cts +16 -0
- package/dist/assert/has-keys.d.cts.map +1 -0
- package/dist/assert/has-keys.d.ts +16 -0
- package/dist/assert/has-keys.d.ts.map +1 -0
- package/dist/assert/has-keys.js +54 -0
- package/dist/assert/has-keys.js.map +1 -0
- package/dist/assert/has-members.cjs +67 -0
- package/dist/assert/has-members.cjs.map +1 -0
- package/dist/assert/has-members.d.cts +48 -0
- package/dist/assert/has-members.d.cts.map +1 -0
- package/dist/assert/has-members.d.ts +48 -0
- package/dist/assert/has-members.d.ts.map +1 -0
- package/dist/assert/has-members.js +64 -0
- package/dist/assert/has-members.js.map +1 -0
- package/dist/assert/has-property.cjs +61 -0
- package/dist/assert/has-property.cjs.map +1 -0
- package/dist/assert/has-property.d.cts +22 -0
- package/dist/assert/has-property.d.cts.map +1 -0
- package/dist/assert/has-property.d.ts +22 -0
- package/dist/assert/has-property.d.ts.map +1 -0
- package/dist/assert/has-property.js +58 -0
- package/dist/assert/has-property.js.map +1 -0
- package/dist/assert/has-size.cjs +122 -0
- package/dist/assert/has-size.cjs.map +1 -0
- package/dist/assert/has-size.d.cts +42 -0
- package/dist/assert/has-size.d.cts.map +1 -0
- package/dist/assert/has-size.d.ts +42 -0
- package/dist/assert/has-size.d.ts.map +1 -0
- package/dist/assert/has-size.js +118 -0
- package/dist/assert/has-size.js.map +1 -0
- package/dist/assert/in-ballpark.cjs +44 -0
- package/dist/assert/in-ballpark.cjs.map +1 -0
- package/dist/assert/in-ballpark.d.cts +16 -0
- package/dist/assert/in-ballpark.d.cts.map +1 -0
- package/dist/assert/in-ballpark.d.ts +16 -0
- package/dist/assert/in-ballpark.d.ts.map +1 -0
- package/dist/assert/in-ballpark.js +41 -0
- package/dist/assert/in-ballpark.js.map +1 -0
- package/dist/assert/includes.cjs +30 -0
- package/dist/assert/includes.cjs.map +1 -0
- package/dist/assert/includes.d.cts +24 -0
- package/dist/assert/includes.d.cts.map +1 -0
- package/dist/assert/includes.d.ts +24 -0
- package/dist/assert/includes.d.ts.map +1 -0
- package/dist/assert/includes.js +27 -0
- package/dist/assert/includes.js.map +1 -0
- package/dist/assert/instance-of.cjs +36 -0
- package/dist/assert/instance-of.cjs.map +1 -0
- package/dist/assert/instance-of.d.cts +16 -0
- package/dist/assert/instance-of.d.cts.map +1 -0
- package/dist/assert/instance-of.d.ts +16 -0
- package/dist/assert/instance-of.d.ts.map +1 -0
- package/dist/assert/instance-of.js +32 -0
- package/dist/assert/instance-of.js.map +1 -0
- package/dist/assert/is-after.cjs +29 -0
- package/dist/assert/is-after.cjs.map +1 -0
- package/dist/assert/is-after.d.cts +11 -0
- package/dist/assert/is-after.d.cts.map +1 -0
- package/dist/assert/is-after.d.ts +11 -0
- package/dist/assert/is-after.d.ts.map +1 -0
- package/dist/assert/is-after.js +26 -0
- package/dist/assert/is-after.js.map +1 -0
- package/dist/assert/is-before.cjs +29 -0
- package/dist/assert/is-before.cjs.map +1 -0
- package/dist/assert/is-before.d.cts +11 -0
- package/dist/assert/is-before.d.cts.map +1 -0
- package/dist/assert/is-before.d.ts +11 -0
- package/dist/assert/is-before.d.ts.map +1 -0
- package/dist/assert/is-before.js +26 -0
- package/dist/assert/is-before.js.map +1 -0
- package/dist/assert/is-between.cjs +47 -0
- package/dist/assert/is-between.cjs.map +1 -0
- package/dist/assert/is-between.d.cts +15 -0
- package/dist/assert/is-between.d.cts.map +1 -0
- package/dist/assert/is-between.d.ts +15 -0
- package/dist/assert/is-between.d.ts.map +1 -0
- package/dist/assert/is-between.js +44 -0
- package/dist/assert/is-between.js.map +1 -0
- package/dist/assert/is-empty.cjs +98 -0
- package/dist/assert/is-empty.cjs.map +1 -0
- package/dist/assert/is-empty.d.cts +31 -0
- package/dist/assert/is-empty.d.cts.map +1 -0
- package/dist/assert/is-empty.d.ts +31 -0
- package/dist/assert/is-empty.d.ts.map +1 -0
- package/dist/assert/is-empty.js +94 -0
- package/dist/assert/is-empty.js.map +1 -0
- package/dist/assert/is-type.cjs +34 -0
- package/dist/assert/is-type.cjs.map +1 -0
- package/dist/assert/is-type.d.cts +97 -0
- package/dist/assert/is-type.d.cts.map +1 -0
- package/dist/assert/is-type.d.ts +97 -0
- package/dist/assert/is-type.d.ts.map +1 -0
- package/dist/assert/is-type.js +31 -0
- package/dist/assert/is-type.js.map +1 -0
- package/dist/assert/less-than-equal.cjs +36 -0
- package/dist/assert/less-than-equal.cjs.map +1 -0
- package/dist/assert/less-than-equal.d.cts +11 -0
- package/dist/assert/less-than-equal.d.cts.map +1 -0
- package/dist/assert/less-than-equal.d.ts +11 -0
- package/dist/assert/less-than-equal.d.ts.map +1 -0
- package/dist/assert/less-than-equal.js +33 -0
- package/dist/assert/less-than-equal.js.map +1 -0
- package/dist/assert/less-than.cjs +34 -0
- package/dist/assert/less-than.cjs.map +1 -0
- package/dist/assert/less-than.d.cts +11 -0
- package/dist/assert/less-than.d.cts.map +1 -0
- package/dist/assert/less-than.d.ts +11 -0
- package/dist/assert/less-than.d.ts.map +1 -0
- package/dist/assert/less-than.js +31 -0
- package/dist/assert/less-than.js.map +1 -0
- package/dist/assert/match.cjs +31 -0
- package/dist/assert/match.cjs.map +1 -0
- package/dist/assert/match.d.cts +15 -0
- package/dist/assert/match.d.cts.map +1 -0
- package/dist/assert/match.d.ts +15 -0
- package/dist/assert/match.d.ts.map +1 -0
- package/dist/assert/match.js +28 -0
- package/dist/assert/match.js.map +1 -0
- package/dist/assert/rejects.cjs +49 -0
- package/dist/assert/rejects.cjs.map +1 -0
- package/dist/assert/rejects.d.cts +36 -0
- package/dist/assert/rejects.d.cts.map +1 -0
- package/dist/assert/rejects.d.ts +36 -0
- package/dist/assert/rejects.d.ts.map +1 -0
- package/dist/assert/rejects.js +46 -0
- package/dist/assert/rejects.js.map +1 -0
- package/dist/assert/round-to.cjs +54 -0
- package/dist/assert/round-to.cjs.map +1 -0
- package/dist/assert/round-to.d.cts +15 -0
- package/dist/assert/round-to.d.cts.map +1 -0
- package/dist/assert/round-to.d.ts +15 -0
- package/dist/assert/round-to.d.ts.map +1 -0
- package/dist/assert/round-to.js +51 -0
- package/dist/assert/round-to.js.map +1 -0
- package/dist/assert/starts-with.cjs +30 -0
- package/dist/assert/starts-with.cjs.map +1 -0
- package/dist/assert/starts-with.d.cts +14 -0
- package/dist/assert/starts-with.d.cts.map +1 -0
- package/dist/assert/starts-with.d.ts +14 -0
- package/dist/assert/starts-with.d.ts.map +1 -0
- package/dist/assert/starts-with.js +27 -0
- package/dist/assert/starts-with.js.map +1 -0
- package/dist/assert/throws.cjs +41 -0
- package/dist/assert/throws.cjs.map +1 -0
- package/dist/{throws-CYLYG7gu.d.cts → assert/throws.d.cts} +4 -11
- package/dist/assert/throws.d.cts.map +1 -0
- package/dist/{throws-BlzO4xvg.d.ts → assert/throws.d.ts} +3 -12
- package/dist/assert/throws.d.ts.map +1 -0
- package/dist/assert/throws.js +38 -0
- package/dist/assert/throws.js.map +1 -0
- package/dist/assert.cjs +143 -52
- package/dist/assert.cjs.map +1 -0
- package/dist/assert.d.cts +34 -3
- package/dist/assert.d.cts.map +1 -0
- package/dist/assert.d.ts +34 -3
- package/dist/assert.d.ts.map +1 -0
- package/dist/assert.js +87 -2
- package/dist/assert.js.map +1 -0
- package/dist/expect/after.cjs +15 -0
- package/dist/expect/after.cjs.map +1 -0
- package/dist/expect/after.js +16 -0
- package/dist/expect/after.js.map +1 -0
- package/dist/expect/ballpark.cjs +15 -0
- package/dist/expect/ballpark.cjs.map +1 -0
- package/dist/expect/ballpark.js +16 -0
- package/dist/expect/ballpark.js.map +1 -0
- package/dist/expect/before.cjs +15 -0
- package/dist/expect/before.cjs.map +1 -0
- package/dist/expect/before.js +16 -0
- package/dist/expect/before.js.map +1 -0
- package/dist/expect/between.cjs +15 -0
- package/dist/expect/between.cjs.map +1 -0
- package/dist/expect/between.js +16 -0
- package/dist/expect/between.js.map +1 -0
- package/dist/expect/empty.cjs +15 -0
- package/dist/expect/empty.cjs.map +1 -0
- package/dist/expect/empty.js +16 -0
- package/dist/expect/empty.js.map +1 -0
- package/dist/expect/end-with.cjs +15 -0
- package/dist/expect/end-with.cjs.map +1 -0
- package/dist/expect/end-with.js +16 -0
- package/dist/expect/end-with.js.map +1 -0
- package/dist/expect/eql.cjs +21 -0
- package/dist/expect/eql.cjs.map +1 -0
- package/dist/expect/eql.js +22 -0
- package/dist/expect/eql.js.map +1 -0
- package/dist/expect/equal-shorthand.cjs +34 -0
- package/dist/expect/equal-shorthand.cjs.map +1 -0
- package/dist/expect/equal-shorthand.js +33 -0
- package/dist/expect/equal-shorthand.js.map +1 -0
- package/dist/expect/equal.cjs +27 -0
- package/dist/expect/equal.cjs.map +1 -0
- package/dist/expect/equal.js +28 -0
- package/dist/expect/equal.js.map +1 -0
- package/dist/expect/excluding.cjs +19 -0
- package/dist/expect/excluding.cjs.map +1 -0
- package/dist/expect/excluding.js +18 -0
- package/dist/expect/excluding.js.map +1 -0
- package/dist/expect/greater-than-equal.cjs +25 -0
- package/dist/expect/greater-than-equal.cjs.map +1 -0
- package/dist/expect/greater-than-equal.js +26 -0
- package/dist/expect/greater-than-equal.js.map +1 -0
- package/dist/expect/greater-than.cjs +25 -0
- package/dist/expect/greater-than.cjs.map +1 -0
- package/dist/expect/greater-than.js +26 -0
- package/dist/expect/greater-than.js.map +1 -0
- package/dist/expect/has-property.cjs +20 -0
- package/dist/expect/has-property.cjs.map +1 -0
- package/dist/expect/has-property.js +21 -0
- package/dist/expect/has-property.js.map +1 -0
- package/dist/expect/include.cjs +21 -0
- package/dist/expect/include.cjs.map +1 -0
- package/dist/expect/include.js +22 -0
- package/dist/expect/include.js.map +1 -0
- package/dist/expect/instance-of-shorthand.cjs +24 -0
- package/dist/expect/instance-of-shorthand.cjs.map +1 -0
- package/dist/expect/instance-of-shorthand.js +25 -0
- package/dist/expect/instance-of-shorthand.js.map +1 -0
- package/dist/expect/instance-of.cjs +15 -0
- package/dist/expect/instance-of.cjs.map +1 -0
- package/dist/expect/instance-of.js +16 -0
- package/dist/expect/instance-of.js.map +1 -0
- package/dist/expect/keys.cjs +15 -0
- package/dist/expect/keys.cjs.map +1 -0
- package/dist/expect/keys.js +16 -0
- package/dist/expect/keys.js.map +1 -0
- package/dist/expect/length.cjs +21 -0
- package/dist/expect/length.cjs.map +1 -0
- package/dist/expect/length.js +22 -0
- package/dist/expect/length.js.map +1 -0
- package/dist/expect/less-than-equal.cjs +25 -0
- package/dist/expect/less-than-equal.cjs.map +1 -0
- package/dist/expect/less-than-equal.js +26 -0
- package/dist/expect/less-than-equal.js.map +1 -0
- package/dist/expect/less-than.cjs +25 -0
- package/dist/expect/less-than.cjs.map +1 -0
- package/dist/expect/less-than.js +26 -0
- package/dist/expect/less-than.js.map +1 -0
- package/dist/expect/match.cjs +15 -0
- package/dist/expect/match.cjs.map +1 -0
- package/dist/expect/match.js +16 -0
- package/dist/expect/match.js.map +1 -0
- package/dist/expect/members.cjs +41 -0
- package/dist/expect/members.cjs.map +1 -0
- package/dist/expect/members.js +42 -0
- package/dist/expect/members.js.map +1 -0
- package/dist/expect/reject.cjs +14 -0
- package/dist/expect/reject.cjs.map +1 -0
- package/dist/expect/reject.js +15 -0
- package/dist/expect/reject.js.map +1 -0
- package/dist/expect/round-to.cjs +15 -0
- package/dist/expect/round-to.cjs.map +1 -0
- package/dist/expect/round-to.js +16 -0
- package/dist/expect/round-to.js.map +1 -0
- package/dist/expect/start-with.cjs +15 -0
- package/dist/expect/start-with.cjs.map +1 -0
- package/dist/expect/start-with.js +16 -0
- package/dist/expect/start-with.js.map +1 -0
- package/dist/expect/throw.cjs +14 -0
- package/dist/expect/throw.cjs.map +1 -0
- package/dist/expect/throw.js +15 -0
- package/dist/expect/throw.js.map +1 -0
- package/dist/expect/type-shorthand.cjs +29 -0
- package/dist/expect/type-shorthand.cjs.map +1 -0
- package/dist/expect/type-shorthand.js +30 -0
- package/dist/expect/type-shorthand.js.map +1 -0
- package/dist/expect/type.cjs +15 -0
- package/dist/expect/type.cjs.map +1 -0
- package/dist/expect/type.js +16 -0
- package/dist/expect/type.js.map +1 -0
- package/dist/expect.cjs +144 -0
- package/dist/expect.cjs.map +1 -0
- package/dist/expect.d.cts +10 -0
- package/dist/expect.d.cts.map +1 -0
- package/dist/expect.d.ts +10 -0
- package/dist/expect.d.ts.map +1 -0
- package/dist/expect.js +141 -0
- package/dist/expect.js.map +1 -0
- package/dist/expect.types.d.cts +67 -3
- package/dist/expect.types.d.cts.map +1 -0
- package/dist/expect.types.d.ts +67 -3
- package/dist/expect.types.d.ts.map +1 -0
- package/dist/index.cjs +13 -582
- package/dist/index.d.cts +8 -15
- package/dist/index.d.ts +8 -15
- package/dist/index.js +8 -575
- package/dist/mixins.cjs +11 -0
- package/dist/mixins.cjs.map +1 -0
- package/dist/mixins.d.cts +28 -0
- package/dist/mixins.d.cts.map +1 -0
- package/dist/mixins.d.ts +28 -0
- package/dist/mixins.d.ts.map +1 -0
- package/dist/mixins.js +9 -0
- package/dist/mixins.js.map +1 -0
- package/dist/utils/chain.cjs +20 -0
- package/dist/utils/chain.cjs.map +1 -0
- package/dist/utils/chain.js +18 -0
- package/dist/utils/chain.js.map +1 -0
- package/dist/utils/fail.cjs +16 -0
- package/dist/utils/fail.cjs.map +1 -0
- package/dist/utils/fail.d.cts +9 -0
- package/dist/utils/fail.d.cts.map +1 -0
- package/dist/utils/fail.d.ts +9 -0
- package/dist/utils/fail.d.ts.map +1 -0
- package/dist/utils/fail.js +14 -0
- package/dist/utils/fail.js.map +1 -0
- package/dist/utils/get-size.cjs +17 -0
- package/dist/utils/get-size.cjs.map +1 -0
- package/dist/utils/get-size.js +15 -0
- package/dist/utils/get-size.js.map +1 -0
- package/dist/utils/get-type.cjs +12 -0
- package/dist/utils/get-type.cjs.map +1 -0
- package/dist/utils/get-type.d.cts +5 -0
- package/dist/utils/get-type.d.cts.map +1 -0
- package/dist/utils/get-type.d.ts +5 -0
- package/dist/utils/get-type.d.ts.map +1 -0
- package/dist/utils/get-type.js +11 -0
- package/dist/utils/get-type.js.map +1 -0
- package/dist/utils/match.cjs +118 -0
- package/dist/utils/match.cjs.map +1 -0
- package/dist/utils/match.d.cts +7 -0
- package/dist/utils/match.d.cts.map +1 -0
- package/dist/utils/match.d.ts +7 -0
- package/dist/utils/match.d.ts.map +1 -0
- package/dist/utils/match.js +114 -0
- package/dist/utils/match.js.map +1 -0
- package/dist/utils/process-error.cjs +86 -0
- package/dist/utils/process-error.cjs.map +1 -0
- package/dist/utils/process-error.d.cts +8 -0
- package/dist/utils/process-error.d.cts.map +1 -0
- package/dist/utils/process-error.d.ts +10 -0
- package/dist/utils/process-error.d.ts.map +1 -0
- package/dist/utils/process-error.js +85 -0
- package/dist/utils/process-error.js.map +1 -0
- package/dist/utils/validate-numeric-and-dates.cjs +20 -0
- package/dist/utils/validate-numeric-and-dates.cjs.map +1 -0
- package/dist/utils/validate-numeric-and-dates.js +18 -0
- package/dist/utils/validate-numeric-and-dates.js.map +1 -0
- package/dist/utils/xor.cjs +9 -0
- package/dist/utils/xor.cjs.map +1 -0
- package/dist/utils/xor.js +8 -0
- package/dist/utils/xor.js.map +1 -0
- package/package.json +1 -1
- package/dist/assert-ChQPKP5C.d.cts +0 -480
- package/dist/assert-ChQPKP5C.d.cts.map +0 -1
- package/dist/assert-CsN7srt-.d.ts +0 -478
- package/dist/assert-CsN7srt-.d.ts.map +0 -1
- package/dist/assert-DZjgWjOw.cjs +0 -1626
- package/dist/assert-DZjgWjOw.cjs.map +0 -1
- package/dist/assert-kFXp7i_B.js +0 -1260
- package/dist/assert-kFXp7i_B.js.map +0 -1
- package/dist/expect.types-CHYPdbCW.d.cts +0 -454
- package/dist/expect.types-CHYPdbCW.d.cts.map +0 -1
- package/dist/expect.types-nBq4Rg8e.d.ts +0 -454
- package/dist/expect.types-nBq4Rg8e.d.ts.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/throws-BlzO4xvg.d.ts.map +0 -1
- package/dist/throws-CYLYG7gu.d.cts.map +0 -1
- /package/dist/{chunk-CTAAG5j7.js → _virtual/rolldown_runtime.js} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"less-than-equal.cjs","names":[],"sources":["../../src/assert/less-than-equal.ts"],"sourcesContent":["import { createAssertion } from 'hein-assertion-utils';\nimport { validateNumericsAndDates } from '../utils/validate-numeric-and-dates.js';\n\ninterface LessThanEqual {\n /**\n * check for <=\n */\n <T extends number | bigint | Date>(actual: T, expected: T, message?: string): void;\n}\n\nexport const [lessThanEqual, notLessThanEqual] = createAssertion({\n messages: {\n lesserThanEqual: 'Expected {{= it.actual }} to be less than or equal to {{= it.expected }}',\n not: 'Expected {{= it.actual }} to not be less than or equal to {{= it.expected }}'\n },\n test:\n (report): LessThanEqual =>\n (actual: any, expected: any, message?: string) => {\n validateNumericsAndDates(actual, expected);\n if (actual > expected) {\n return report({\n status: 'notok',\n messageId: 'lesserThanEqual',\n actual,\n expected,\n message,\n noStringify: true\n });\n }\n return report({ status: 'ok', actual, expected, message, messageId: 'not', noStringify: true });\n }\n});\n"],"mappings":";;;;;;AAUA,MAAa,CAAC,eAAe,8DAAoC;CAC7D,UAAU;EACN,iBAAiB;EACjB,KAAK;EACR;CACD,OACK,YACA,QAAa,UAAe,YAAqB;AAC9C,8DAAyB,QAAQ,SAAS;AAC1C,MAAI,SAAS,SACT,QAAO,OAAO;GACV,QAAQ;GACR,WAAW;GACX;GACA;GACA;GACA,aAAa;GAChB,CAAC;AAEN,SAAO,OAAO;GAAE,QAAQ;GAAM;GAAQ;GAAU;GAAS,WAAW;GAAO,aAAa;GAAM,CAAC;;CAE1G,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/assert/less-than-equal.d.ts
|
|
2
|
+
interface LessThanEqual {
|
|
3
|
+
/**
|
|
4
|
+
* check for <=
|
|
5
|
+
*/
|
|
6
|
+
<T extends number | bigint | Date>(actual: T, expected: T, message?: string): void;
|
|
7
|
+
}
|
|
8
|
+
declare const lessThanEqual: LessThanEqual, notLessThanEqual: LessThanEqual;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { lessThanEqual, notLessThanEqual };
|
|
11
|
+
//# sourceMappingURL=less-than-equal.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"less-than-equal.d.cts","names":[],"sources":["../../src/assert/less-than-equal.ts"],"sourcesContent":[],"mappings":";UAGU,aAAA;EAAA;;;aAIqC,MAAA,GAAA,MAAA,GAAd,IAAc,CAAA,CAAA,MAAA,EAAA,CAAA,EAAA,QAAA,EAAa,CAAb,EAAA,OAAA,CAAA,EAAA,MAAA,CAAA,EAAA,IAAA;;AAAc,cAG/C,aAH+C,EAGlC,aAHkC,EAAA,gBAAA,EAGhB,aAHgB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/assert/less-than-equal.d.ts
|
|
2
|
+
interface LessThanEqual {
|
|
3
|
+
/**
|
|
4
|
+
* check for <=
|
|
5
|
+
*/
|
|
6
|
+
<T extends number | bigint | Date>(actual: T, expected: T, message?: string): void;
|
|
7
|
+
}
|
|
8
|
+
declare const lessThanEqual: LessThanEqual, notLessThanEqual: LessThanEqual;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { lessThanEqual, notLessThanEqual };
|
|
11
|
+
//# sourceMappingURL=less-than-equal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"less-than-equal.d.ts","names":[],"sources":["../../src/assert/less-than-equal.ts"],"sourcesContent":[],"mappings":";UAGU,aAAA;EAAA;;;aAIqC,MAAA,GAAA,MAAA,GAAd,IAAc,CAAA,CAAA,MAAA,EAAA,CAAA,EAAA,QAAA,EAAa,CAAb,EAAA,OAAA,CAAA,EAAA,MAAA,CAAA,EAAA,IAAA;;AAAc,cAG/C,aAH+C,EAGlC,aAHkC,EAAA,gBAAA,EAGhB,aAHgB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { validateNumericsAndDates } from "../utils/validate-numeric-and-dates.js";
|
|
2
|
+
import { createAssertion } from "hein-assertion-utils";
|
|
3
|
+
|
|
4
|
+
//#region src/assert/less-than-equal.ts
|
|
5
|
+
const [lessThanEqual, notLessThanEqual] = createAssertion({
|
|
6
|
+
messages: {
|
|
7
|
+
lesserThanEqual: "Expected {{= it.actual }} to be less than or equal to {{= it.expected }}",
|
|
8
|
+
not: "Expected {{= it.actual }} to not be less than or equal to {{= it.expected }}"
|
|
9
|
+
},
|
|
10
|
+
test: (report) => (actual, expected, message) => {
|
|
11
|
+
validateNumericsAndDates(actual, expected);
|
|
12
|
+
if (actual > expected) return report({
|
|
13
|
+
status: "notok",
|
|
14
|
+
messageId: "lesserThanEqual",
|
|
15
|
+
actual,
|
|
16
|
+
expected,
|
|
17
|
+
message,
|
|
18
|
+
noStringify: true
|
|
19
|
+
});
|
|
20
|
+
return report({
|
|
21
|
+
status: "ok",
|
|
22
|
+
actual,
|
|
23
|
+
expected,
|
|
24
|
+
message,
|
|
25
|
+
messageId: "not",
|
|
26
|
+
noStringify: true
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
export { lessThanEqual, notLessThanEqual };
|
|
33
|
+
//# sourceMappingURL=less-than-equal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"less-than-equal.js","names":[],"sources":["../../src/assert/less-than-equal.ts"],"sourcesContent":["import { createAssertion } from 'hein-assertion-utils';\nimport { validateNumericsAndDates } from '../utils/validate-numeric-and-dates.js';\n\ninterface LessThanEqual {\n /**\n * check for <=\n */\n <T extends number | bigint | Date>(actual: T, expected: T, message?: string): void;\n}\n\nexport const [lessThanEqual, notLessThanEqual] = createAssertion({\n messages: {\n lesserThanEqual: 'Expected {{= it.actual }} to be less than or equal to {{= it.expected }}',\n not: 'Expected {{= it.actual }} to not be less than or equal to {{= it.expected }}'\n },\n test:\n (report): LessThanEqual =>\n (actual: any, expected: any, message?: string) => {\n validateNumericsAndDates(actual, expected);\n if (actual > expected) {\n return report({\n status: 'notok',\n messageId: 'lesserThanEqual',\n actual,\n expected,\n message,\n noStringify: true\n });\n }\n return report({ status: 'ok', actual, expected, message, messageId: 'not', noStringify: true });\n }\n});\n"],"mappings":";;;;AAUA,MAAa,CAAC,eAAe,oBAAoB,gBAAgB;CAC7D,UAAU;EACN,iBAAiB;EACjB,KAAK;EACR;CACD,OACK,YACA,QAAa,UAAe,YAAqB;AAC9C,2BAAyB,QAAQ,SAAS;AAC1C,MAAI,SAAS,SACT,QAAO,OAAO;GACV,QAAQ;GACR,WAAW;GACX;GACA;GACA;GACA,aAAa;GAChB,CAAC;AAEN,SAAO,OAAO;GAAE,QAAQ;GAAM;GAAQ;GAAU;GAAS,WAAW;GAAO,aAAa;GAAM,CAAC;;CAE1G,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_validate_numeric_and_dates = require('../utils/validate-numeric-and-dates.cjs');
|
|
3
|
+
let hein_assertion_utils = require("hein-assertion-utils");
|
|
4
|
+
hein_assertion_utils = require_rolldown_runtime.__toESM(hein_assertion_utils);
|
|
5
|
+
|
|
6
|
+
//#region src/assert/less-than.ts
|
|
7
|
+
const [lessThan, notLessThan] = (0, hein_assertion_utils.createAssertion)({
|
|
8
|
+
messages: {
|
|
9
|
+
lesserThan: "Expected {{= it.actual }} to be less than {{= it.expected }}",
|
|
10
|
+
not: "Expected {{= it.actual }} to not be less than {{= it.expected }}"
|
|
11
|
+
},
|
|
12
|
+
test: (report) => (actual, expected, message) => {
|
|
13
|
+
require_validate_numeric_and_dates.validateNumericsAndDates(actual, expected);
|
|
14
|
+
if (actual >= expected) return report({
|
|
15
|
+
status: "notok",
|
|
16
|
+
messageId: "lesserThan",
|
|
17
|
+
actual,
|
|
18
|
+
expected,
|
|
19
|
+
message
|
|
20
|
+
});
|
|
21
|
+
return report({
|
|
22
|
+
status: "ok",
|
|
23
|
+
actual,
|
|
24
|
+
expected,
|
|
25
|
+
message,
|
|
26
|
+
messageId: "not"
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
exports.lessThan = lessThan;
|
|
33
|
+
exports.notLessThan = notLessThan;
|
|
34
|
+
//# sourceMappingURL=less-than.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"less-than.cjs","names":[],"sources":["../../src/assert/less-than.ts"],"sourcesContent":["import { createAssertion } from 'hein-assertion-utils';\nimport { validateNumericsAndDates } from '../utils/validate-numeric-and-dates.js';\n\ninterface LesserThan {\n /**\n * check for <\n */\n <T extends number | bigint | Date>(actual: T, expected: T, message?: string): void;\n}\n\nexport const [lessThan, notLessThan] = createAssertion({\n messages: {\n lesserThan: 'Expected {{= it.actual }} to be less than {{= it.expected }}',\n not: 'Expected {{= it.actual }} to not be less than {{= it.expected }}'\n },\n test:\n (report): LesserThan =>\n (actual: any, expected: any, message?: string) => {\n validateNumericsAndDates(actual, expected);\n if (actual >= expected) {\n return report({ status: 'notok', messageId: 'lesserThan', actual, expected, message });\n }\n return report({ status: 'ok', actual, expected, message, messageId: 'not' });\n }\n});\n"],"mappings":";;;;;;AAUA,MAAa,CAAC,UAAU,yDAA+B;CACnD,UAAU;EACN,YAAY;EACZ,KAAK;EACR;CACD,OACK,YACA,QAAa,UAAe,YAAqB;AAC9C,8DAAyB,QAAQ,SAAS;AAC1C,MAAI,UAAU,SACV,QAAO,OAAO;GAAE,QAAQ;GAAS,WAAW;GAAc;GAAQ;GAAU;GAAS,CAAC;AAE1F,SAAO,OAAO;GAAE,QAAQ;GAAM;GAAQ;GAAU;GAAS,WAAW;GAAO,CAAC;;CAEvF,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/assert/less-than.d.ts
|
|
2
|
+
interface LesserThan {
|
|
3
|
+
/**
|
|
4
|
+
* check for <
|
|
5
|
+
*/
|
|
6
|
+
<T extends number | bigint | Date>(actual: T, expected: T, message?: string): void;
|
|
7
|
+
}
|
|
8
|
+
declare const lessThan: LesserThan, notLessThan: LesserThan;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { lessThan, notLessThan };
|
|
11
|
+
//# sourceMappingURL=less-than.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"less-than.d.cts","names":[],"sources":["../../src/assert/less-than.ts"],"sourcesContent":[],"mappings":";UAGU,UAAA;EAAA;;;aAIqC,MAAA,GAAA,MAAA,GAAd,IAAc,CAAA,CAAA,MAAA,EAAA,CAAA,EAAA,QAAA,EAAa,CAAb,EAAA,OAAA,CAAA,EAAA,MAAA,CAAA,EAAA,IAAA;;AAAc,cAG/C,QAH+C,EAGvC,UAHuC,EAAA,WAAA,EAG1B,UAH0B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/assert/less-than.d.ts
|
|
2
|
+
interface LesserThan {
|
|
3
|
+
/**
|
|
4
|
+
* check for <
|
|
5
|
+
*/
|
|
6
|
+
<T extends number | bigint | Date>(actual: T, expected: T, message?: string): void;
|
|
7
|
+
}
|
|
8
|
+
declare const lessThan: LesserThan, notLessThan: LesserThan;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { lessThan, notLessThan };
|
|
11
|
+
//# sourceMappingURL=less-than.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"less-than.d.ts","names":[],"sources":["../../src/assert/less-than.ts"],"sourcesContent":[],"mappings":";UAGU,UAAA;EAAA;;;aAIqC,MAAA,GAAA,MAAA,GAAd,IAAc,CAAA,CAAA,MAAA,EAAA,CAAA,EAAA,QAAA,EAAa,CAAb,EAAA,OAAA,CAAA,EAAA,MAAA,CAAA,EAAA,IAAA;;AAAc,cAG/C,QAH+C,EAGvC,UAHuC,EAAA,WAAA,EAG1B,UAH0B"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { validateNumericsAndDates } from "../utils/validate-numeric-and-dates.js";
|
|
2
|
+
import { createAssertion } from "hein-assertion-utils";
|
|
3
|
+
|
|
4
|
+
//#region src/assert/less-than.ts
|
|
5
|
+
const [lessThan, notLessThan] = createAssertion({
|
|
6
|
+
messages: {
|
|
7
|
+
lesserThan: "Expected {{= it.actual }} to be less than {{= it.expected }}",
|
|
8
|
+
not: "Expected {{= it.actual }} to not be less than {{= it.expected }}"
|
|
9
|
+
},
|
|
10
|
+
test: (report) => (actual, expected, message) => {
|
|
11
|
+
validateNumericsAndDates(actual, expected);
|
|
12
|
+
if (actual >= expected) return report({
|
|
13
|
+
status: "notok",
|
|
14
|
+
messageId: "lesserThan",
|
|
15
|
+
actual,
|
|
16
|
+
expected,
|
|
17
|
+
message
|
|
18
|
+
});
|
|
19
|
+
return report({
|
|
20
|
+
status: "ok",
|
|
21
|
+
actual,
|
|
22
|
+
expected,
|
|
23
|
+
message,
|
|
24
|
+
messageId: "not"
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
//#endregion
|
|
30
|
+
export { lessThan, notLessThan };
|
|
31
|
+
//# sourceMappingURL=less-than.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"less-than.js","names":[],"sources":["../../src/assert/less-than.ts"],"sourcesContent":["import { createAssertion } from 'hein-assertion-utils';\nimport { validateNumericsAndDates } from '../utils/validate-numeric-and-dates.js';\n\ninterface LesserThan {\n /**\n * check for <\n */\n <T extends number | bigint | Date>(actual: T, expected: T, message?: string): void;\n}\n\nexport const [lessThan, notLessThan] = createAssertion({\n messages: {\n lesserThan: 'Expected {{= it.actual }} to be less than {{= it.expected }}',\n not: 'Expected {{= it.actual }} to not be less than {{= it.expected }}'\n },\n test:\n (report): LesserThan =>\n (actual: any, expected: any, message?: string) => {\n validateNumericsAndDates(actual, expected);\n if (actual >= expected) {\n return report({ status: 'notok', messageId: 'lesserThan', actual, expected, message });\n }\n return report({ status: 'ok', actual, expected, message, messageId: 'not' });\n }\n});\n"],"mappings":";;;;AAUA,MAAa,CAAC,UAAU,eAAe,gBAAgB;CACnD,UAAU;EACN,YAAY;EACZ,KAAK;EACR;CACD,OACK,YACA,QAAa,UAAe,YAAqB;AAC9C,2BAAyB,QAAQ,SAAS;AAC1C,MAAI,UAAU,SACV,QAAO,OAAO;GAAE,QAAQ;GAAS,WAAW;GAAc;GAAQ;GAAU;GAAS,CAAC;AAE1F,SAAO,OAAO;GAAE,QAAQ;GAAM;GAAQ;GAAU;GAAS,WAAW;GAAO,CAAC;;CAEvF,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let hein_assertion_utils = require("hein-assertion-utils");
|
|
3
|
+
hein_assertion_utils = require_rolldown_runtime.__toESM(hein_assertion_utils);
|
|
4
|
+
|
|
5
|
+
//#region src/assert/match.ts
|
|
6
|
+
const [match, notMatch] = (0, hein_assertion_utils.createAssertion)({
|
|
7
|
+
messages: {
|
|
8
|
+
noMatch: "Expected {{= it.actual }} to match {{= it.expected }}",
|
|
9
|
+
not: "Expected {{= it.actual }} to not match {{= it.expected }}"
|
|
10
|
+
},
|
|
11
|
+
test: (report) => (actual, regex) => {
|
|
12
|
+
if (!regex.test(actual)) return report({
|
|
13
|
+
messageId: "noMatch",
|
|
14
|
+
status: "notok",
|
|
15
|
+
actual,
|
|
16
|
+
noStringify: true,
|
|
17
|
+
expected: regex.toString()
|
|
18
|
+
});
|
|
19
|
+
report({
|
|
20
|
+
status: "ok",
|
|
21
|
+
actual,
|
|
22
|
+
expected: regex.toString(),
|
|
23
|
+
noStringify: true
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
29
|
+
exports.match = match;
|
|
30
|
+
exports.notMatch = notMatch;
|
|
31
|
+
//# sourceMappingURL=match.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"match.cjs","names":[],"sources":["../../src/assert/match.ts"],"sourcesContent":["import { createAssertion } from 'hein-assertion-utils';\n\ninterface IsMatch {\n /**\n * check if string matches regex\n * @param actual\n * @param regex\n * @example match('foo', /foo/);\n * @example notMatch('foo', /bar/);\n */\n (actual: string, regex: RegExp): void;\n}\n\nexport const [match, notMatch] = createAssertion({\n messages: {\n noMatch: 'Expected {{= it.actual }} to match {{= it.expected }}',\n not: 'Expected {{= it.actual }} to not match {{= it.expected }}'\n },\n test:\n (report): IsMatch =>\n (actual: string, regex: RegExp) => {\n if (!regex.test(actual)) {\n return report({\n messageId: 'noMatch',\n status: 'notok',\n actual,\n noStringify: true,\n expected: regex.toString()\n });\n }\n report({\n status: 'ok',\n actual,\n expected: regex.toString(),\n noStringify: true\n });\n }\n});\n"],"mappings":";;;;;AAaA,MAAa,CAAC,OAAO,sDAA4B;CAC7C,UAAU;EACN,SAAS;EACT,KAAK;EACR;CACD,OACK,YACA,QAAgB,UAAkB;AAC/B,MAAI,CAAC,MAAM,KAAK,OAAO,CACnB,QAAO,OAAO;GACV,WAAW;GACX,QAAQ;GACR;GACA,aAAa;GACb,UAAU,MAAM,UAAU;GAC7B,CAAC;AAEN,SAAO;GACH,QAAQ;GACR;GACA,UAAU,MAAM,UAAU;GAC1B,aAAa;GAChB,CAAC;;CAEb,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/assert/match.d.ts
|
|
2
|
+
interface IsMatch {
|
|
3
|
+
/**
|
|
4
|
+
* check if string matches regex
|
|
5
|
+
* @param actual
|
|
6
|
+
* @param regex
|
|
7
|
+
* @example match('foo', /foo/);
|
|
8
|
+
* @example notMatch('foo', /bar/);
|
|
9
|
+
*/
|
|
10
|
+
(actual: string, regex: RegExp): void;
|
|
11
|
+
}
|
|
12
|
+
declare const match: IsMatch, notMatch: IsMatch;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { match, notMatch };
|
|
15
|
+
//# sourceMappingURL=match.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"match.d.cts","names":[],"sources":["../../src/assert/match.ts"],"sourcesContent":[],"mappings":";UAEU,OAAA;EAAA;AAWV;;;;;;0BAH4B;;cAGd,OAAK,mBAAU"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/assert/match.d.ts
|
|
2
|
+
interface IsMatch {
|
|
3
|
+
/**
|
|
4
|
+
* check if string matches regex
|
|
5
|
+
* @param actual
|
|
6
|
+
* @param regex
|
|
7
|
+
* @example match('foo', /foo/);
|
|
8
|
+
* @example notMatch('foo', /bar/);
|
|
9
|
+
*/
|
|
10
|
+
(actual: string, regex: RegExp): void;
|
|
11
|
+
}
|
|
12
|
+
declare const match: IsMatch, notMatch: IsMatch;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { match, notMatch };
|
|
15
|
+
//# sourceMappingURL=match.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"match.d.ts","names":[],"sources":["../../src/assert/match.ts"],"sourcesContent":[],"mappings":";UAEU,OAAA;EAAA;AAWV;;;;;;0BAH4B;;cAGd,OAAK,mBAAU"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { createAssertion } from "hein-assertion-utils";
|
|
2
|
+
|
|
3
|
+
//#region src/assert/match.ts
|
|
4
|
+
const [match, notMatch] = createAssertion({
|
|
5
|
+
messages: {
|
|
6
|
+
noMatch: "Expected {{= it.actual }} to match {{= it.expected }}",
|
|
7
|
+
not: "Expected {{= it.actual }} to not match {{= it.expected }}"
|
|
8
|
+
},
|
|
9
|
+
test: (report) => (actual, regex) => {
|
|
10
|
+
if (!regex.test(actual)) return report({
|
|
11
|
+
messageId: "noMatch",
|
|
12
|
+
status: "notok",
|
|
13
|
+
actual,
|
|
14
|
+
noStringify: true,
|
|
15
|
+
expected: regex.toString()
|
|
16
|
+
});
|
|
17
|
+
report({
|
|
18
|
+
status: "ok",
|
|
19
|
+
actual,
|
|
20
|
+
expected: regex.toString(),
|
|
21
|
+
noStringify: true
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
export { match, notMatch };
|
|
28
|
+
//# sourceMappingURL=match.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"match.js","names":[],"sources":["../../src/assert/match.ts"],"sourcesContent":["import { createAssertion } from 'hein-assertion-utils';\n\ninterface IsMatch {\n /**\n * check if string matches regex\n * @param actual\n * @param regex\n * @example match('foo', /foo/);\n * @example notMatch('foo', /bar/);\n */\n (actual: string, regex: RegExp): void;\n}\n\nexport const [match, notMatch] = createAssertion({\n messages: {\n noMatch: 'Expected {{= it.actual }} to match {{= it.expected }}',\n not: 'Expected {{= it.actual }} to not match {{= it.expected }}'\n },\n test:\n (report): IsMatch =>\n (actual: string, regex: RegExp) => {\n if (!regex.test(actual)) {\n return report({\n messageId: 'noMatch',\n status: 'notok',\n actual,\n noStringify: true,\n expected: regex.toString()\n });\n }\n report({\n status: 'ok',\n actual,\n expected: regex.toString(),\n noStringify: true\n });\n }\n});\n"],"mappings":";;;AAaA,MAAa,CAAC,OAAO,YAAY,gBAAgB;CAC7C,UAAU;EACN,SAAS;EACT,KAAK;EACR;CACD,OACK,YACA,QAAgB,UAAkB;AAC/B,MAAI,CAAC,MAAM,KAAK,OAAO,CACnB,QAAO,OAAO;GACV,WAAW;GACX,QAAQ;GACR;GACA,aAAa;GACb,UAAU,MAAM,UAAU;GAC7B,CAAC;AAEN,SAAO;GACH,QAAQ;GACR;GACA,UAAU,MAAM,UAAU;GAC1B,aAAa;GAChB,CAAC;;CAEb,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_process_error = require('../utils/process-error.cjs');
|
|
3
|
+
let hein_assertion_utils = require("hein-assertion-utils");
|
|
4
|
+
hein_assertion_utils = require_rolldown_runtime.__toESM(hein_assertion_utils);
|
|
5
|
+
|
|
6
|
+
//#region src/assert/rejects.ts
|
|
7
|
+
const [rejects, notRejects] = (0, hein_assertion_utils.createAssertion)({
|
|
8
|
+
messages: {
|
|
9
|
+
invalidArgument: "Expected {{= it.actual }} to be a Promise",
|
|
10
|
+
nonError: "Expected Promise to reject with an instance of Error",
|
|
11
|
+
throws: "Expected Promise to reject",
|
|
12
|
+
invalidConstructor: "Expected Promise to reject with {{= it.expected }}",
|
|
13
|
+
predicate: "Expected {{= it.actual }} to match predicate function",
|
|
14
|
+
regex: "Expected Promise to reject with an error matching {{= it.expected }}",
|
|
15
|
+
not: "Expected Promise to not reject",
|
|
16
|
+
notConstructor: "Expected Promise to not reject with a {{= it.expected }}",
|
|
17
|
+
notPredicate: "Expected {{= it.actual }} to not match predicate function",
|
|
18
|
+
notRegex: "Expected Promise to not reject with an error matching {{= it.expected }}"
|
|
19
|
+
},
|
|
20
|
+
test: (report) => async (promise, narrowerOrMessage, message) => {
|
|
21
|
+
if (!promise || typeof promise.then !== "function") {
|
|
22
|
+
report({
|
|
23
|
+
noStringify: true,
|
|
24
|
+
status: "notok",
|
|
25
|
+
messageId: "invalidArgument",
|
|
26
|
+
actual: typeof promise,
|
|
27
|
+
expected: "Promise"
|
|
28
|
+
});
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
try {
|
|
32
|
+
await promise;
|
|
33
|
+
} catch (error) {
|
|
34
|
+
require_process_error.processError(report, error, narrowerOrMessage, message);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
report({
|
|
38
|
+
noStringify: true,
|
|
39
|
+
status: "notok",
|
|
40
|
+
messageId: "throws",
|
|
41
|
+
message: typeof narrowerOrMessage === "string" ? narrowerOrMessage : message
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
//#endregion
|
|
47
|
+
exports.notRejects = notRejects;
|
|
48
|
+
exports.rejects = rejects;
|
|
49
|
+
//# sourceMappingURL=rejects.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rejects.cjs","names":[],"sources":["../../src/assert/rejects.ts"],"sourcesContent":["import { createAssertion } from 'hein-assertion-utils';\nimport { type Constructor, type ErrorPredicate, processError } from '../utils/process-error.js';\n\ninterface Rejects {\n /**\n * check if promise rejects\n * @param promise\n * @example rejects(Promise.reject());\n */\n (promise: Promise<any>, message?: string): Promise<void>;\n /**\n * check if promise rejects with an instance of constructor\n * @param promise\n * @param constructor - expected error constructor\n * @example rejects(Promise.reject(new Error()), Error);\n */\n (promise: Promise<any>, constructor: Constructor, message?: string): Promise<void>;\n /**\n * check if promise rejects with a specific error message\n * @param promise\n * @param regex - expected error message regex\n * @example rejects(Promise.reject(new Error('This is worrying)), /worrying/);\n */\n (promise: Promise<any>, constructor: RegExp, message?: string): Promise<void>;\n /**\n * check if promise rejects with and matches the predicate function\n * @param promise\n * @param predicate - predicate function that receives the error and returns boolean\n * @example rejects(Promise.reject(new Error('This is worrying')), (error) => error.message === 'This is worrying');));\n */\n (promise: Promise<any>, constructor: ErrorPredicate, message?: string): Promise<void>;\n}\n\nexport const [rejects, notRejects] = createAssertion({\n messages: {\n invalidArgument: 'Expected {{= it.actual }} to be a Promise',\n nonError: 'Expected Promise to reject with an instance of Error',\n throws: 'Expected Promise to reject',\n invalidConstructor: 'Expected Promise to reject with {{= it.expected }}',\n predicate: 'Expected {{= it.actual }} to match predicate function',\n regex: 'Expected Promise to reject with an error matching {{= it.expected }}',\n not: 'Expected Promise to not reject',\n notConstructor: 'Expected Promise to not reject with a {{= it.expected }}',\n notPredicate: 'Expected {{= it.actual }} to not match predicate function',\n notRegex: 'Expected Promise to not reject with an error matching {{= it.expected }}'\n },\n test:\n (report): Rejects =>\n async (promise: Promise<any>, narrowerOrMessage?, message?) => {\n // TODO: invalid argument in not case\n if (!promise || typeof promise.then !== 'function') {\n report({\n noStringify: true,\n status: 'notok',\n messageId: 'invalidArgument',\n actual: typeof promise,\n expected: 'Promise'\n });\n return;\n }\n try {\n await promise;\n } catch (error) {\n processError(report, error, narrowerOrMessage, message);\n return;\n }\n report({\n noStringify: true,\n status: 'notok',\n messageId: 'throws',\n message: typeof narrowerOrMessage === 'string' ? narrowerOrMessage : message\n });\n return;\n }\n});\n"],"mappings":";;;;;;AAiCA,MAAa,CAAC,SAAS,wDAA8B;CACjD,UAAU;EACN,iBAAiB;EACjB,UAAU;EACV,QAAQ;EACR,oBAAoB;EACpB,WAAW;EACX,OAAO;EACP,KAAK;EACL,gBAAgB;EAChB,cAAc;EACd,UAAU;EACb;CACD,OACK,WACD,OAAO,SAAuB,mBAAoB,YAAa;AAE3D,MAAI,CAAC,WAAW,OAAO,QAAQ,SAAS,YAAY;AAChD,UAAO;IACH,aAAa;IACb,QAAQ;IACR,WAAW;IACX,QAAQ,OAAO;IACf,UAAU;IACb,CAAC;AACF;;AAEJ,MAAI;AACA,SAAM;WACD,OAAO;AACZ,sCAAa,QAAQ,OAAO,mBAAmB,QAAQ;AACvD;;AAEJ,SAAO;GACH,aAAa;GACb,QAAQ;GACR,WAAW;GACX,SAAS,OAAO,sBAAsB,WAAW,oBAAoB;GACxE,CAAC;;CAGb,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Constructor, ErrorPredicate } from "../utils/process-error.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/assert/rejects.d.ts
|
|
4
|
+
interface Rejects {
|
|
5
|
+
/**
|
|
6
|
+
* check if promise rejects
|
|
7
|
+
* @param promise
|
|
8
|
+
* @example rejects(Promise.reject());
|
|
9
|
+
*/
|
|
10
|
+
(promise: Promise<any>, message?: string): Promise<void>;
|
|
11
|
+
/**
|
|
12
|
+
* check if promise rejects with an instance of constructor
|
|
13
|
+
* @param promise
|
|
14
|
+
* @param constructor - expected error constructor
|
|
15
|
+
* @example rejects(Promise.reject(new Error()), Error);
|
|
16
|
+
*/
|
|
17
|
+
(promise: Promise<any>, constructor: Constructor, message?: string): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* check if promise rejects with a specific error message
|
|
20
|
+
* @param promise
|
|
21
|
+
* @param regex - expected error message regex
|
|
22
|
+
* @example rejects(Promise.reject(new Error('This is worrying)), /worrying/);
|
|
23
|
+
*/
|
|
24
|
+
(promise: Promise<any>, constructor: RegExp, message?: string): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* check if promise rejects with and matches the predicate function
|
|
27
|
+
* @param promise
|
|
28
|
+
* @param predicate - predicate function that receives the error and returns boolean
|
|
29
|
+
* @example rejects(Promise.reject(new Error('This is worrying')), (error) => error.message === 'This is worrying');));
|
|
30
|
+
*/
|
|
31
|
+
(promise: Promise<any>, constructor: ErrorPredicate, message?: string): Promise<void>;
|
|
32
|
+
}
|
|
33
|
+
declare const rejects: Rejects, notRejects: Rejects;
|
|
34
|
+
//#endregion
|
|
35
|
+
export { notRejects, rejects };
|
|
36
|
+
//# sourceMappingURL=rejects.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rejects.d.cts","names":[],"sources":["../../src/assert/rejects.ts"],"sourcesContent":[],"mappings":";;;UAGU,OAAA;;AAFsF;;;;UAelF,EAPA,OAOA,CAAA,GAAA,CAAA,EAAA,OAAA,CAAA,EAAA,MAAA,CAAA,EAPiC,OAOjC,CAAA,IAAA,CAAA;;;;;;;UAc2B,EAd3B,OAc2B,CAAA,GAAA,CAAA,EAAA,WAAA,EAdA,WAcA,EAAA,OAAA,CAAA,EAAA,MAAA,CAAA,EAdgC,OAchC,CAAA,IAAA,CAAA;;;AAGzC;;;;EAyCE,CAAA,OAAA,EAnDY,OAmDZ,CAAA,GAAA,CAAA,EAAA,WAAA,EAnDuC,MAmDvC,EAAA,OAAA,CAAA,EAAA,MAAA,CAAA,EAnDkE,OAmDlE,CAAA,IAAA,CAAA;EAzCqB;;;;;;YAHT,2BAA2B,mCAAmC;;cAG9D,SAAO,qBAAY"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Constructor, ErrorPredicate } from "../utils/process-error.js";
|
|
2
|
+
|
|
3
|
+
//#region src/assert/rejects.d.ts
|
|
4
|
+
interface Rejects {
|
|
5
|
+
/**
|
|
6
|
+
* check if promise rejects
|
|
7
|
+
* @param promise
|
|
8
|
+
* @example rejects(Promise.reject());
|
|
9
|
+
*/
|
|
10
|
+
(promise: Promise<any>, message?: string): Promise<void>;
|
|
11
|
+
/**
|
|
12
|
+
* check if promise rejects with an instance of constructor
|
|
13
|
+
* @param promise
|
|
14
|
+
* @param constructor - expected error constructor
|
|
15
|
+
* @example rejects(Promise.reject(new Error()), Error);
|
|
16
|
+
*/
|
|
17
|
+
(promise: Promise<any>, constructor: Constructor, message?: string): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* check if promise rejects with a specific error message
|
|
20
|
+
* @param promise
|
|
21
|
+
* @param regex - expected error message regex
|
|
22
|
+
* @example rejects(Promise.reject(new Error('This is worrying)), /worrying/);
|
|
23
|
+
*/
|
|
24
|
+
(promise: Promise<any>, constructor: RegExp, message?: string): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* check if promise rejects with and matches the predicate function
|
|
27
|
+
* @param promise
|
|
28
|
+
* @param predicate - predicate function that receives the error and returns boolean
|
|
29
|
+
* @example rejects(Promise.reject(new Error('This is worrying')), (error) => error.message === 'This is worrying');));
|
|
30
|
+
*/
|
|
31
|
+
(promise: Promise<any>, constructor: ErrorPredicate, message?: string): Promise<void>;
|
|
32
|
+
}
|
|
33
|
+
declare const rejects: Rejects, notRejects: Rejects;
|
|
34
|
+
//#endregion
|
|
35
|
+
export { notRejects, rejects };
|
|
36
|
+
//# sourceMappingURL=rejects.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rejects.d.ts","names":[],"sources":["../../src/assert/rejects.ts"],"sourcesContent":[],"mappings":";;;UAGU,OAAA;;AAFsF;;;;UAelF,EAPA,OAOA,CAAA,GAAA,CAAA,EAAA,OAAA,CAAA,EAAA,MAAA,CAAA,EAPiC,OAOjC,CAAA,IAAA,CAAA;;;;;;;UAc2B,EAd3B,OAc2B,CAAA,GAAA,CAAA,EAAA,WAAA,EAdA,WAcA,EAAA,OAAA,CAAA,EAAA,MAAA,CAAA,EAdgC,OAchC,CAAA,IAAA,CAAA;;;AAGzC;;;;EAyCE,CAAA,OAAA,EAnDY,OAmDZ,CAAA,GAAA,CAAA,EAAA,WAAA,EAnDuC,MAmDvC,EAAA,OAAA,CAAA,EAAA,MAAA,CAAA,EAnDkE,OAmDlE,CAAA,IAAA,CAAA;EAzCqB;;;;;;YAHT,2BAA2B,mCAAmC;;cAG9D,SAAO,qBAAY"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { processError } from "../utils/process-error.js";
|
|
2
|
+
import { createAssertion } from "hein-assertion-utils";
|
|
3
|
+
|
|
4
|
+
//#region src/assert/rejects.ts
|
|
5
|
+
const [rejects, notRejects] = createAssertion({
|
|
6
|
+
messages: {
|
|
7
|
+
invalidArgument: "Expected {{= it.actual }} to be a Promise",
|
|
8
|
+
nonError: "Expected Promise to reject with an instance of Error",
|
|
9
|
+
throws: "Expected Promise to reject",
|
|
10
|
+
invalidConstructor: "Expected Promise to reject with {{= it.expected }}",
|
|
11
|
+
predicate: "Expected {{= it.actual }} to match predicate function",
|
|
12
|
+
regex: "Expected Promise to reject with an error matching {{= it.expected }}",
|
|
13
|
+
not: "Expected Promise to not reject",
|
|
14
|
+
notConstructor: "Expected Promise to not reject with a {{= it.expected }}",
|
|
15
|
+
notPredicate: "Expected {{= it.actual }} to not match predicate function",
|
|
16
|
+
notRegex: "Expected Promise to not reject with an error matching {{= it.expected }}"
|
|
17
|
+
},
|
|
18
|
+
test: (report) => async (promise, narrowerOrMessage, message) => {
|
|
19
|
+
if (!promise || typeof promise.then !== "function") {
|
|
20
|
+
report({
|
|
21
|
+
noStringify: true,
|
|
22
|
+
status: "notok",
|
|
23
|
+
messageId: "invalidArgument",
|
|
24
|
+
actual: typeof promise,
|
|
25
|
+
expected: "Promise"
|
|
26
|
+
});
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
try {
|
|
30
|
+
await promise;
|
|
31
|
+
} catch (error) {
|
|
32
|
+
processError(report, error, narrowerOrMessage, message);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
report({
|
|
36
|
+
noStringify: true,
|
|
37
|
+
status: "notok",
|
|
38
|
+
messageId: "throws",
|
|
39
|
+
message: typeof narrowerOrMessage === "string" ? narrowerOrMessage : message
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
//#endregion
|
|
45
|
+
export { notRejects, rejects };
|
|
46
|
+
//# sourceMappingURL=rejects.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rejects.js","names":[],"sources":["../../src/assert/rejects.ts"],"sourcesContent":["import { createAssertion } from 'hein-assertion-utils';\nimport { type Constructor, type ErrorPredicate, processError } from '../utils/process-error.js';\n\ninterface Rejects {\n /**\n * check if promise rejects\n * @param promise\n * @example rejects(Promise.reject());\n */\n (promise: Promise<any>, message?: string): Promise<void>;\n /**\n * check if promise rejects with an instance of constructor\n * @param promise\n * @param constructor - expected error constructor\n * @example rejects(Promise.reject(new Error()), Error);\n */\n (promise: Promise<any>, constructor: Constructor, message?: string): Promise<void>;\n /**\n * check if promise rejects with a specific error message\n * @param promise\n * @param regex - expected error message regex\n * @example rejects(Promise.reject(new Error('This is worrying)), /worrying/);\n */\n (promise: Promise<any>, constructor: RegExp, message?: string): Promise<void>;\n /**\n * check if promise rejects with and matches the predicate function\n * @param promise\n * @param predicate - predicate function that receives the error and returns boolean\n * @example rejects(Promise.reject(new Error('This is worrying')), (error) => error.message === 'This is worrying');));\n */\n (promise: Promise<any>, constructor: ErrorPredicate, message?: string): Promise<void>;\n}\n\nexport const [rejects, notRejects] = createAssertion({\n messages: {\n invalidArgument: 'Expected {{= it.actual }} to be a Promise',\n nonError: 'Expected Promise to reject with an instance of Error',\n throws: 'Expected Promise to reject',\n invalidConstructor: 'Expected Promise to reject with {{= it.expected }}',\n predicate: 'Expected {{= it.actual }} to match predicate function',\n regex: 'Expected Promise to reject with an error matching {{= it.expected }}',\n not: 'Expected Promise to not reject',\n notConstructor: 'Expected Promise to not reject with a {{= it.expected }}',\n notPredicate: 'Expected {{= it.actual }} to not match predicate function',\n notRegex: 'Expected Promise to not reject with an error matching {{= it.expected }}'\n },\n test:\n (report): Rejects =>\n async (promise: Promise<any>, narrowerOrMessage?, message?) => {\n // TODO: invalid argument in not case\n if (!promise || typeof promise.then !== 'function') {\n report({\n noStringify: true,\n status: 'notok',\n messageId: 'invalidArgument',\n actual: typeof promise,\n expected: 'Promise'\n });\n return;\n }\n try {\n await promise;\n } catch (error) {\n processError(report, error, narrowerOrMessage, message);\n return;\n }\n report({\n noStringify: true,\n status: 'notok',\n messageId: 'throws',\n message: typeof narrowerOrMessage === 'string' ? narrowerOrMessage : message\n });\n return;\n }\n});\n"],"mappings":";;;;AAiCA,MAAa,CAAC,SAAS,cAAc,gBAAgB;CACjD,UAAU;EACN,iBAAiB;EACjB,UAAU;EACV,QAAQ;EACR,oBAAoB;EACpB,WAAW;EACX,OAAO;EACP,KAAK;EACL,gBAAgB;EAChB,cAAc;EACd,UAAU;EACb;CACD,OACK,WACD,OAAO,SAAuB,mBAAoB,YAAa;AAE3D,MAAI,CAAC,WAAW,OAAO,QAAQ,SAAS,YAAY;AAChD,UAAO;IACH,aAAa;IACb,QAAQ;IACR,WAAW;IACX,QAAQ,OAAO;IACf,UAAU;IACb,CAAC;AACF;;AAEJ,MAAI;AACA,SAAM;WACD,OAAO;AACZ,gBAAa,QAAQ,OAAO,mBAAmB,QAAQ;AACvD;;AAEJ,SAAO;GACH,aAAa;GACb,QAAQ;GACR,WAAW;GACX,SAAS,OAAO,sBAAsB,WAAW,oBAAoB;GACxE,CAAC;;CAGb,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let hein_assertion_utils = require("hein-assertion-utils");
|
|
3
|
+
hein_assertion_utils = require_rolldown_runtime.__toESM(hein_assertion_utils);
|
|
4
|
+
|
|
5
|
+
//#region src/assert/round-to.ts
|
|
6
|
+
const [roundTo, notRoundTo] = (0, hein_assertion_utils.createAssertion)({
|
|
7
|
+
messages: {
|
|
8
|
+
miss: "Expected {{= it.actual }} to round to {{= it.expected }}",
|
|
9
|
+
tooManyDecimals: "Invalid argument for target, decimals for target ({{= it.expected }}) cannot be less than rounding decimals ({{= it.decimals }})",
|
|
10
|
+
not: "Expected {{= it.actual }} to not round to {{= it.expected }}"
|
|
11
|
+
},
|
|
12
|
+
test: (report) => (actual, expected, decimals = 0) => {
|
|
13
|
+
var _expected$toString$sp;
|
|
14
|
+
if (((_expected$toString$sp = expected.toString().split(".")[1]) === null || _expected$toString$sp === void 0 ? void 0 : _expected$toString$sp.length) > decimals) {
|
|
15
|
+
report({
|
|
16
|
+
status: "notok",
|
|
17
|
+
messageId: "tooManyDecimals",
|
|
18
|
+
expected,
|
|
19
|
+
actual,
|
|
20
|
+
data: { decimals },
|
|
21
|
+
noStringify: true
|
|
22
|
+
});
|
|
23
|
+
report({
|
|
24
|
+
status: "ok",
|
|
25
|
+
messageId: "tooManyDecimals",
|
|
26
|
+
expected,
|
|
27
|
+
actual,
|
|
28
|
+
data: { decimals },
|
|
29
|
+
noStringify: true
|
|
30
|
+
});
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
if (round(actual, decimals) === expected) return report({
|
|
34
|
+
status: "ok",
|
|
35
|
+
expected,
|
|
36
|
+
actual
|
|
37
|
+
});
|
|
38
|
+
return report({
|
|
39
|
+
status: "notok",
|
|
40
|
+
messageId: "miss",
|
|
41
|
+
expected,
|
|
42
|
+
actual
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
const round = (value, decimals) => {
|
|
47
|
+
const factor = 10 ** decimals;
|
|
48
|
+
return Math.round(value * factor) / factor;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
//#endregion
|
|
52
|
+
exports.notRoundTo = notRoundTo;
|
|
53
|
+
exports.roundTo = roundTo;
|
|
54
|
+
//# sourceMappingURL=round-to.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"round-to.cjs","names":[],"sources":["../../src/assert/round-to.ts"],"sourcesContent":["import { createAssertion } from 'hein-assertion-utils';\n\ninterface RoundTo {\n /**\n * check if value rounds to target\n * @param actual\n * @param expected\n * @param [decimals=0] - number of decimals to round to, defaults to 0\n * @example roundTo(1.234, 1.23, 2);\n */\n (actual: number, expected: number, decimals?: number): void;\n}\n\nexport const [roundTo, notRoundTo] = createAssertion({\n messages: {\n miss: 'Expected {{= it.actual }} to round to {{= it.expected }}',\n tooManyDecimals:\n 'Invalid argument for target, decimals for target ({{= it.expected }}) cannot be less than rounding decimals ({{= it.decimals }})',\n not: 'Expected {{= it.actual }} to not round to {{= it.expected }}'\n },\n test:\n (report): RoundTo =>\n (actual: number, expected: number, decimals = 0) => {\n if (expected.toString().split('.')[1]?.length > decimals) {\n report({\n status: 'notok',\n messageId: 'tooManyDecimals',\n expected,\n actual,\n data: { decimals },\n noStringify: true\n });\n report({\n status: 'ok',\n messageId: 'tooManyDecimals',\n expected,\n actual,\n data: { decimals },\n noStringify: true\n });\n return true;\n }\n if (round(actual, decimals) === expected) {\n return report({ status: 'ok', expected, actual });\n }\n return report({ status: 'notok', messageId: 'miss', expected, actual });\n }\n});\n\nconst round = (value: number, decimals: number) => {\n const factor = 10 ** decimals;\n return Math.round(value * factor) / factor;\n};\n"],"mappings":";;;;;AAaA,MAAa,CAAC,SAAS,wDAA8B;CACjD,UAAU;EACN,MAAM;EACN,iBACI;EACJ,KAAK;EACR;CACD,OACK,YACA,QAAgB,UAAkB,WAAW,MAAM;;AAChD,gCAAI,SAAS,UAAU,CAAC,MAAM,IAAI,CAAC,kFAAI,UAAS,UAAU;AACtD,UAAO;IACH,QAAQ;IACR,WAAW;IACX;IACA;IACA,MAAM,EAAE,UAAU;IAClB,aAAa;IAChB,CAAC;AACF,UAAO;IACH,QAAQ;IACR,WAAW;IACX;IACA;IACA,MAAM,EAAE,UAAU;IAClB,aAAa;IAChB,CAAC;AACF,UAAO;;AAEX,MAAI,MAAM,QAAQ,SAAS,KAAK,SAC5B,QAAO,OAAO;GAAE,QAAQ;GAAM;GAAU;GAAQ,CAAC;AAErD,SAAO,OAAO;GAAE,QAAQ;GAAS,WAAW;GAAQ;GAAU;GAAQ,CAAC;;CAElF,CAAC;AAEF,MAAM,SAAS,OAAe,aAAqB;CAC/C,MAAM,SAAS,MAAM;AACrB,QAAO,KAAK,MAAM,QAAQ,OAAO,GAAG"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/assert/round-to.d.ts
|
|
2
|
+
interface RoundTo {
|
|
3
|
+
/**
|
|
4
|
+
* check if value rounds to target
|
|
5
|
+
* @param actual
|
|
6
|
+
* @param expected
|
|
7
|
+
* @param [decimals=0] - number of decimals to round to, defaults to 0
|
|
8
|
+
* @example roundTo(1.234, 1.23, 2);
|
|
9
|
+
*/
|
|
10
|
+
(actual: number, expected: number, decimals?: number): void;
|
|
11
|
+
}
|
|
12
|
+
declare const roundTo: RoundTo, notRoundTo: RoundTo;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { notRoundTo, roundTo };
|
|
15
|
+
//# sourceMappingURL=round-to.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"round-to.d.cts","names":[],"sources":["../../src/assert/round-to.ts"],"sourcesContent":[],"mappings":";UAEU,OAAA;EAAA;AAWV;;;;;;;;cAAc,SAAO,qBAAY"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/assert/round-to.d.ts
|
|
2
|
+
interface RoundTo {
|
|
3
|
+
/**
|
|
4
|
+
* check if value rounds to target
|
|
5
|
+
* @param actual
|
|
6
|
+
* @param expected
|
|
7
|
+
* @param [decimals=0] - number of decimals to round to, defaults to 0
|
|
8
|
+
* @example roundTo(1.234, 1.23, 2);
|
|
9
|
+
*/
|
|
10
|
+
(actual: number, expected: number, decimals?: number): void;
|
|
11
|
+
}
|
|
12
|
+
declare const roundTo: RoundTo, notRoundTo: RoundTo;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { notRoundTo, roundTo };
|
|
15
|
+
//# sourceMappingURL=round-to.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"round-to.d.ts","names":[],"sources":["../../src/assert/round-to.ts"],"sourcesContent":[],"mappings":";UAEU,OAAA;EAAA;AAWV;;;;;;;;cAAc,SAAO,qBAAY"}
|