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,44 @@
|
|
|
1
|
+
import { createAssertion } from "hein-assertion-utils";
|
|
2
|
+
|
|
3
|
+
//#region src/assert/is-between.ts
|
|
4
|
+
const [isBetween, notBetween] = createAssertion({
|
|
5
|
+
messages: {
|
|
6
|
+
notBetween: "Expected {{= it.actual }} to be between {{= it.lesser }} and {{= it.greater }}",
|
|
7
|
+
not: "Expected {{= it.actual }} to not be between {{= it.lesser }} and {{= it.greater }}"
|
|
8
|
+
},
|
|
9
|
+
test: (report) => (actual, start, end, { inclusive = true } = {}) => {
|
|
10
|
+
const [greater, lesser] = end > start ? [end, start] : [start, end];
|
|
11
|
+
const inclusivelyBetween = actual <= greater && actual >= lesser;
|
|
12
|
+
const exclusivelyBetween = actual < greater && actual > lesser;
|
|
13
|
+
if (inclusive && !inclusivelyBetween) return report({
|
|
14
|
+
messageId: "notBetween",
|
|
15
|
+
status: "notok",
|
|
16
|
+
actual,
|
|
17
|
+
data: {
|
|
18
|
+
lesser,
|
|
19
|
+
greater
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
if (!inclusive && !exclusivelyBetween) return report({
|
|
23
|
+
messageId: "notBetween",
|
|
24
|
+
status: "notok",
|
|
25
|
+
actual,
|
|
26
|
+
data: {
|
|
27
|
+
lesser,
|
|
28
|
+
greater
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
return report({
|
|
32
|
+
status: "ok",
|
|
33
|
+
actual,
|
|
34
|
+
data: {
|
|
35
|
+
lesser,
|
|
36
|
+
greater
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
//#endregion
|
|
43
|
+
export { isBetween, notBetween };
|
|
44
|
+
//# sourceMappingURL=is-between.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-between.js","names":[],"sources":["../../src/assert/is-between.ts"],"sourcesContent":["import { createAssertion } from 'hein-assertion-utils';\n\ninterface IsBetweenOptions {\n inclusive?: boolean;\n}\n\ninterface IsBetween {\n /**\n * check that date is Between another date\n */\n <T extends Date>(actual: T, start: T, end: T, options?: IsBetweenOptions): void;\n <T extends number>(actual: T, start: T, end: T, options?: IsBetweenOptions): void;\n}\n\nexport const [isBetween, notBetween] = createAssertion({\n messages: {\n notBetween: 'Expected {{= it.actual }} to be between {{= it.lesser }} and {{= it.greater }}',\n not: 'Expected {{= it.actual }} to not be between {{= it.lesser }} and {{= it.greater }}'\n },\n test:\n (report): IsBetween =>\n <T extends Date | number>(actual: T, start: T, end: T, { inclusive = true }: IsBetweenOptions = {}) => {\n const [greater, lesser] = end > start ? [end, start] : [start, end];\n const inclusivelyBetween = actual <= greater && actual >= lesser;\n const exclusivelyBetween = actual < greater && actual > lesser;\n if (inclusive && !inclusivelyBetween) {\n return report({\n messageId: 'notBetween',\n status: 'notok',\n actual,\n data: { lesser, greater }\n });\n }\n if (!inclusive && !exclusivelyBetween) {\n return report({\n messageId: 'notBetween',\n status: 'notok',\n actual,\n data: { lesser, greater }\n });\n }\n return report({\n status: 'ok',\n actual,\n data: { lesser, greater }\n });\n }\n});\n"],"mappings":";;;AAcA,MAAa,CAAC,WAAW,cAAc,gBAAgB;CACnD,UAAU;EACN,YAAY;EACZ,KAAK;EACR;CACD,OACK,YACyB,QAAW,OAAU,KAAQ,EAAE,YAAY,SAA2B,EAAE,KAAK;EACnG,MAAM,CAAC,SAAS,UAAU,MAAM,QAAQ,CAAC,KAAK,MAAM,GAAG,CAAC,OAAO,IAAI;EACnE,MAAM,qBAAqB,UAAU,WAAW,UAAU;EAC1D,MAAM,qBAAqB,SAAS,WAAW,SAAS;AACxD,MAAI,aAAa,CAAC,mBACd,QAAO,OAAO;GACV,WAAW;GACX,QAAQ;GACR;GACA,MAAM;IAAE;IAAQ;IAAS;GAC5B,CAAC;AAEN,MAAI,CAAC,aAAa,CAAC,mBACf,QAAO,OAAO;GACV,WAAW;GACX,QAAQ;GACR;GACA,MAAM;IAAE;IAAQ;IAAS;GAC5B,CAAC;AAEN,SAAO,OAAO;GACV,QAAQ;GACR;GACA,MAAM;IAAE;IAAQ;IAAS;GAC5B,CAAC;;CAEb,CAAC"}
|
|
@@ -0,0 +1,98 @@
|
|
|
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
|
+
let lodash_isPlainObject_js = require("lodash/isPlainObject.js");
|
|
5
|
+
lodash_isPlainObject_js = require_rolldown_runtime.__toESM(lodash_isPlainObject_js);
|
|
6
|
+
|
|
7
|
+
//#region src/assert/is-empty.ts
|
|
8
|
+
const [isEmpty, notIsEmpty] = (0, hein_assertion_utils.createAssertion)({
|
|
9
|
+
messages: {
|
|
10
|
+
array: "Expected array to be empty",
|
|
11
|
+
object: "Expected object to be empty",
|
|
12
|
+
map: "Expected Map to be empty",
|
|
13
|
+
set: "Expected Set to be empty",
|
|
14
|
+
not: "Expected array to not be empty",
|
|
15
|
+
notObject: "Expected object to not be empty",
|
|
16
|
+
notMap: "Expected Map to not be empty",
|
|
17
|
+
notSet: "Expected Set to not be empty",
|
|
18
|
+
invalidArgument: "Expected {{= it.actual }} to be an array, object, Map, or Set"
|
|
19
|
+
},
|
|
20
|
+
test: (report) => (actual, message) => {
|
|
21
|
+
if (Array.isArray(actual)) {
|
|
22
|
+
if (actual.length === 0) return report({
|
|
23
|
+
message,
|
|
24
|
+
status: "ok",
|
|
25
|
+
actual,
|
|
26
|
+
expected: []
|
|
27
|
+
});
|
|
28
|
+
return report({
|
|
29
|
+
message,
|
|
30
|
+
status: "notok",
|
|
31
|
+
messageId: "array",
|
|
32
|
+
actual,
|
|
33
|
+
expected: []
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
if ((0, lodash_isPlainObject_js.default)(actual)) {
|
|
37
|
+
if (Object.keys(actual).length === 0) return report({
|
|
38
|
+
message,
|
|
39
|
+
status: "ok",
|
|
40
|
+
messageId: "notObject",
|
|
41
|
+
actual
|
|
42
|
+
});
|
|
43
|
+
return report({
|
|
44
|
+
message,
|
|
45
|
+
status: "notok",
|
|
46
|
+
messageId: "object",
|
|
47
|
+
actual,
|
|
48
|
+
expected: {}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
if (actual instanceof Map) {
|
|
52
|
+
if (actual.size === 0) return report({
|
|
53
|
+
message,
|
|
54
|
+
status: "ok",
|
|
55
|
+
messageId: "notMap",
|
|
56
|
+
actual
|
|
57
|
+
});
|
|
58
|
+
return report({
|
|
59
|
+
message,
|
|
60
|
+
status: "notok",
|
|
61
|
+
messageId: "map",
|
|
62
|
+
actual,
|
|
63
|
+
expected: /* @__PURE__ */ new Map()
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
if (actual instanceof Set) {
|
|
67
|
+
if (actual.size === 0) return report({
|
|
68
|
+
message,
|
|
69
|
+
status: "ok",
|
|
70
|
+
messageId: "notSet",
|
|
71
|
+
actual
|
|
72
|
+
});
|
|
73
|
+
return report({
|
|
74
|
+
message,
|
|
75
|
+
status: "notok",
|
|
76
|
+
messageId: "set",
|
|
77
|
+
actual
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
report({
|
|
81
|
+
message,
|
|
82
|
+
status: "notok",
|
|
83
|
+
messageId: "invalidArgument",
|
|
84
|
+
actual
|
|
85
|
+
});
|
|
86
|
+
report({
|
|
87
|
+
message,
|
|
88
|
+
status: "ok",
|
|
89
|
+
messageId: "invalidArgument",
|
|
90
|
+
actual
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
//#endregion
|
|
96
|
+
exports.isEmpty = isEmpty;
|
|
97
|
+
exports.notIsEmpty = notIsEmpty;
|
|
98
|
+
//# sourceMappingURL=is-empty.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-empty.cjs","names":[],"sources":["../../src/assert/is-empty.ts"],"sourcesContent":["import isPlainObject from 'lodash/isPlainObject.js';\nimport { createAssertion } from 'hein-assertion-utils';\n\ninterface IsEmpty {\n /**\n * check if array is empty\n * @param array\n * @example isEmpty([]);\n */\n <T>(array: T[], message?: string): void;\n /**\n * check if object is empty\n * @param object\n * @example isEmpty({});\n */\n (object: Record<string, unknown>, message?: string): void;\n /**\n * check if Map is empty\n * @param map\n * @example isEmpty(new Map());\n */\n <K, V>(map: Map<K, V>, message?: string): void;\n /**\n * check if Set is empty\n * @param set\n * @example isEmpty(new Set());\n */\n <T>(set: Set<T>, message?: string): void;\n}\n\nexport const [isEmpty, notIsEmpty] = createAssertion({\n messages: {\n array: 'Expected array to be empty',\n object: 'Expected object to be empty',\n map: 'Expected Map to be empty',\n set: 'Expected Set to be empty',\n not: 'Expected array to not be empty',\n notObject: 'Expected object to not be empty',\n notMap: 'Expected Map to not be empty',\n notSet: 'Expected Set to not be empty',\n invalidArgument: 'Expected {{= it.actual }} to be an array, object, Map, or Set'\n },\n test:\n (report): IsEmpty =>\n <T>(actual: T, message?: string) => {\n if (Array.isArray(actual)) {\n if (actual.length === 0) {\n return report({ message, status: 'ok', actual, expected: [] as any });\n }\n return report({ message, status: 'notok', messageId: 'array', actual, expected: [] as any });\n }\n if (isPlainObject(actual)) {\n if (Object.keys(actual).length === 0) {\n return report({ message, status: 'ok', messageId: 'notObject', actual });\n }\n return report({ message, status: 'notok', messageId: 'object', actual, expected: {} });\n }\n if (actual instanceof Map) {\n if (actual.size === 0) {\n return report({ message, status: 'ok', messageId: 'notMap', actual });\n }\n return report({ message, status: 'notok', messageId: 'map', actual, expected: new Map() });\n }\n if (actual instanceof Set) {\n if (actual.size === 0) {\n return report({ message, status: 'ok', messageId: 'notSet', actual });\n }\n return report({ message, status: 'notok', messageId: 'set', actual });\n }\n report({ message, status: 'notok', messageId: 'invalidArgument', actual });\n report({ message, status: 'ok', messageId: 'invalidArgument', actual });\n }\n});\n"],"mappings":";;;;;;;AA8BA,MAAa,CAAC,SAAS,wDAA8B;CACjD,UAAU;EACN,OAAO;EACP,QAAQ;EACR,KAAK;EACL,KAAK;EACL,KAAK;EACL,WAAW;EACX,QAAQ;EACR,QAAQ;EACR,iBAAiB;EACpB;CACD,OACK,YACG,QAAW,YAAqB;AAChC,MAAI,MAAM,QAAQ,OAAO,EAAE;AACvB,OAAI,OAAO,WAAW,EAClB,QAAO,OAAO;IAAE;IAAS,QAAQ;IAAM;IAAQ,UAAU,EAAE;IAAS,CAAC;AAEzE,UAAO,OAAO;IAAE;IAAS,QAAQ;IAAS,WAAW;IAAS;IAAQ,UAAU,EAAE;IAAS,CAAC;;AAEhG,2CAAkB,OAAO,EAAE;AACvB,OAAI,OAAO,KAAK,OAAO,CAAC,WAAW,EAC/B,QAAO,OAAO;IAAE;IAAS,QAAQ;IAAM,WAAW;IAAa;IAAQ,CAAC;AAE5E,UAAO,OAAO;IAAE;IAAS,QAAQ;IAAS,WAAW;IAAU;IAAQ,UAAU,EAAE;IAAE,CAAC;;AAE1F,MAAI,kBAAkB,KAAK;AACvB,OAAI,OAAO,SAAS,EAChB,QAAO,OAAO;IAAE;IAAS,QAAQ;IAAM,WAAW;IAAU;IAAQ,CAAC;AAEzE,UAAO,OAAO;IAAE;IAAS,QAAQ;IAAS,WAAW;IAAO;IAAQ,0BAAU,IAAI,KAAK;IAAE,CAAC;;AAE9F,MAAI,kBAAkB,KAAK;AACvB,OAAI,OAAO,SAAS,EAChB,QAAO,OAAO;IAAE;IAAS,QAAQ;IAAM,WAAW;IAAU;IAAQ,CAAC;AAEzE,UAAO,OAAO;IAAE;IAAS,QAAQ;IAAS,WAAW;IAAO;IAAQ,CAAC;;AAEzE,SAAO;GAAE;GAAS,QAAQ;GAAS,WAAW;GAAmB;GAAQ,CAAC;AAC1E,SAAO;GAAE;GAAS,QAAQ;GAAM,WAAW;GAAmB;GAAQ,CAAC;;CAElF,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
//#region src/assert/is-empty.d.ts
|
|
2
|
+
interface IsEmpty {
|
|
3
|
+
/**
|
|
4
|
+
* check if array is empty
|
|
5
|
+
* @param array
|
|
6
|
+
* @example isEmpty([]);
|
|
7
|
+
*/
|
|
8
|
+
<T>(array: T[], message?: string): void;
|
|
9
|
+
/**
|
|
10
|
+
* check if object is empty
|
|
11
|
+
* @param object
|
|
12
|
+
* @example isEmpty({});
|
|
13
|
+
*/
|
|
14
|
+
(object: Record<string, unknown>, message?: string): void;
|
|
15
|
+
/**
|
|
16
|
+
* check if Map is empty
|
|
17
|
+
* @param map
|
|
18
|
+
* @example isEmpty(new Map());
|
|
19
|
+
*/
|
|
20
|
+
<K, V>(map: Map<K, V>, message?: string): void;
|
|
21
|
+
/**
|
|
22
|
+
* check if Set is empty
|
|
23
|
+
* @param set
|
|
24
|
+
* @example isEmpty(new Set());
|
|
25
|
+
*/
|
|
26
|
+
<T>(set: Set<T>, message?: string): void;
|
|
27
|
+
}
|
|
28
|
+
declare const isEmpty: IsEmpty, notIsEmpty: IsEmpty;
|
|
29
|
+
//#endregion
|
|
30
|
+
export { isEmpty, notIsEmpty };
|
|
31
|
+
//# sourceMappingURL=is-empty.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-empty.d.cts","names":[],"sources":["../../src/assert/is-empty.ts"],"sourcesContent":[],"mappings":";UAGU,OAAA;EAAA;;;;;KAkBa,CAAA,KAAA,EAZR,CAYQ,EAAA,EAAA,OAAA,CAAA,EAAA,MAAA,CAAA,EAAA,IAAA;;;;;AASvB;EAAqB,CAAA,MAAA,EAfR,MAeQ,CAAA,MAAA,EAAA,OAAA,CAAA,EAAA,OAAA,CAAA,EAAA,MAAA,CAAA,EAAA,IAAA;;;;;;cATL,IAAI,GAAG;;;;;;WAMV,IAAI;;cAGH,SAAO,qBAAY"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
//#region src/assert/is-empty.d.ts
|
|
2
|
+
interface IsEmpty {
|
|
3
|
+
/**
|
|
4
|
+
* check if array is empty
|
|
5
|
+
* @param array
|
|
6
|
+
* @example isEmpty([]);
|
|
7
|
+
*/
|
|
8
|
+
<T>(array: T[], message?: string): void;
|
|
9
|
+
/**
|
|
10
|
+
* check if object is empty
|
|
11
|
+
* @param object
|
|
12
|
+
* @example isEmpty({});
|
|
13
|
+
*/
|
|
14
|
+
(object: Record<string, unknown>, message?: string): void;
|
|
15
|
+
/**
|
|
16
|
+
* check if Map is empty
|
|
17
|
+
* @param map
|
|
18
|
+
* @example isEmpty(new Map());
|
|
19
|
+
*/
|
|
20
|
+
<K, V>(map: Map<K, V>, message?: string): void;
|
|
21
|
+
/**
|
|
22
|
+
* check if Set is empty
|
|
23
|
+
* @param set
|
|
24
|
+
* @example isEmpty(new Set());
|
|
25
|
+
*/
|
|
26
|
+
<T>(set: Set<T>, message?: string): void;
|
|
27
|
+
}
|
|
28
|
+
declare const isEmpty: IsEmpty, notIsEmpty: IsEmpty;
|
|
29
|
+
//#endregion
|
|
30
|
+
export { isEmpty, notIsEmpty };
|
|
31
|
+
//# sourceMappingURL=is-empty.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-empty.d.ts","names":[],"sources":["../../src/assert/is-empty.ts"],"sourcesContent":[],"mappings":";UAGU,OAAA;EAAA;;;;;KAkBa,CAAA,KAAA,EAZR,CAYQ,EAAA,EAAA,OAAA,CAAA,EAAA,MAAA,CAAA,EAAA,IAAA;;;;;AASvB;EAAqB,CAAA,MAAA,EAfR,MAeQ,CAAA,MAAA,EAAA,OAAA,CAAA,EAAA,OAAA,CAAA,EAAA,MAAA,CAAA,EAAA,IAAA;;;;;;cATL,IAAI,GAAG;;;;;;WAMV,IAAI;;cAGH,SAAO,qBAAY"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { createAssertion } from "hein-assertion-utils";
|
|
2
|
+
import isPlainObject from "lodash/isPlainObject.js";
|
|
3
|
+
|
|
4
|
+
//#region src/assert/is-empty.ts
|
|
5
|
+
const [isEmpty, notIsEmpty] = createAssertion({
|
|
6
|
+
messages: {
|
|
7
|
+
array: "Expected array to be empty",
|
|
8
|
+
object: "Expected object to be empty",
|
|
9
|
+
map: "Expected Map to be empty",
|
|
10
|
+
set: "Expected Set to be empty",
|
|
11
|
+
not: "Expected array to not be empty",
|
|
12
|
+
notObject: "Expected object to not be empty",
|
|
13
|
+
notMap: "Expected Map to not be empty",
|
|
14
|
+
notSet: "Expected Set to not be empty",
|
|
15
|
+
invalidArgument: "Expected {{= it.actual }} to be an array, object, Map, or Set"
|
|
16
|
+
},
|
|
17
|
+
test: (report) => (actual, message) => {
|
|
18
|
+
if (Array.isArray(actual)) {
|
|
19
|
+
if (actual.length === 0) return report({
|
|
20
|
+
message,
|
|
21
|
+
status: "ok",
|
|
22
|
+
actual,
|
|
23
|
+
expected: []
|
|
24
|
+
});
|
|
25
|
+
return report({
|
|
26
|
+
message,
|
|
27
|
+
status: "notok",
|
|
28
|
+
messageId: "array",
|
|
29
|
+
actual,
|
|
30
|
+
expected: []
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
if (isPlainObject(actual)) {
|
|
34
|
+
if (Object.keys(actual).length === 0) return report({
|
|
35
|
+
message,
|
|
36
|
+
status: "ok",
|
|
37
|
+
messageId: "notObject",
|
|
38
|
+
actual
|
|
39
|
+
});
|
|
40
|
+
return report({
|
|
41
|
+
message,
|
|
42
|
+
status: "notok",
|
|
43
|
+
messageId: "object",
|
|
44
|
+
actual,
|
|
45
|
+
expected: {}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
if (actual instanceof Map) {
|
|
49
|
+
if (actual.size === 0) return report({
|
|
50
|
+
message,
|
|
51
|
+
status: "ok",
|
|
52
|
+
messageId: "notMap",
|
|
53
|
+
actual
|
|
54
|
+
});
|
|
55
|
+
return report({
|
|
56
|
+
message,
|
|
57
|
+
status: "notok",
|
|
58
|
+
messageId: "map",
|
|
59
|
+
actual,
|
|
60
|
+
expected: /* @__PURE__ */ new Map()
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
if (actual instanceof Set) {
|
|
64
|
+
if (actual.size === 0) return report({
|
|
65
|
+
message,
|
|
66
|
+
status: "ok",
|
|
67
|
+
messageId: "notSet",
|
|
68
|
+
actual
|
|
69
|
+
});
|
|
70
|
+
return report({
|
|
71
|
+
message,
|
|
72
|
+
status: "notok",
|
|
73
|
+
messageId: "set",
|
|
74
|
+
actual
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
report({
|
|
78
|
+
message,
|
|
79
|
+
status: "notok",
|
|
80
|
+
messageId: "invalidArgument",
|
|
81
|
+
actual
|
|
82
|
+
});
|
|
83
|
+
report({
|
|
84
|
+
message,
|
|
85
|
+
status: "ok",
|
|
86
|
+
messageId: "invalidArgument",
|
|
87
|
+
actual
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
//#endregion
|
|
93
|
+
export { isEmpty, notIsEmpty };
|
|
94
|
+
//# sourceMappingURL=is-empty.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-empty.js","names":[],"sources":["../../src/assert/is-empty.ts"],"sourcesContent":["import isPlainObject from 'lodash/isPlainObject.js';\nimport { createAssertion } from 'hein-assertion-utils';\n\ninterface IsEmpty {\n /**\n * check if array is empty\n * @param array\n * @example isEmpty([]);\n */\n <T>(array: T[], message?: string): void;\n /**\n * check if object is empty\n * @param object\n * @example isEmpty({});\n */\n (object: Record<string, unknown>, message?: string): void;\n /**\n * check if Map is empty\n * @param map\n * @example isEmpty(new Map());\n */\n <K, V>(map: Map<K, V>, message?: string): void;\n /**\n * check if Set is empty\n * @param set\n * @example isEmpty(new Set());\n */\n <T>(set: Set<T>, message?: string): void;\n}\n\nexport const [isEmpty, notIsEmpty] = createAssertion({\n messages: {\n array: 'Expected array to be empty',\n object: 'Expected object to be empty',\n map: 'Expected Map to be empty',\n set: 'Expected Set to be empty',\n not: 'Expected array to not be empty',\n notObject: 'Expected object to not be empty',\n notMap: 'Expected Map to not be empty',\n notSet: 'Expected Set to not be empty',\n invalidArgument: 'Expected {{= it.actual }} to be an array, object, Map, or Set'\n },\n test:\n (report): IsEmpty =>\n <T>(actual: T, message?: string) => {\n if (Array.isArray(actual)) {\n if (actual.length === 0) {\n return report({ message, status: 'ok', actual, expected: [] as any });\n }\n return report({ message, status: 'notok', messageId: 'array', actual, expected: [] as any });\n }\n if (isPlainObject(actual)) {\n if (Object.keys(actual).length === 0) {\n return report({ message, status: 'ok', messageId: 'notObject', actual });\n }\n return report({ message, status: 'notok', messageId: 'object', actual, expected: {} });\n }\n if (actual instanceof Map) {\n if (actual.size === 0) {\n return report({ message, status: 'ok', messageId: 'notMap', actual });\n }\n return report({ message, status: 'notok', messageId: 'map', actual, expected: new Map() });\n }\n if (actual instanceof Set) {\n if (actual.size === 0) {\n return report({ message, status: 'ok', messageId: 'notSet', actual });\n }\n return report({ message, status: 'notok', messageId: 'set', actual });\n }\n report({ message, status: 'notok', messageId: 'invalidArgument', actual });\n report({ message, status: 'ok', messageId: 'invalidArgument', actual });\n }\n});\n"],"mappings":";;;;AA8BA,MAAa,CAAC,SAAS,cAAc,gBAAgB;CACjD,UAAU;EACN,OAAO;EACP,QAAQ;EACR,KAAK;EACL,KAAK;EACL,KAAK;EACL,WAAW;EACX,QAAQ;EACR,QAAQ;EACR,iBAAiB;EACpB;CACD,OACK,YACG,QAAW,YAAqB;AAChC,MAAI,MAAM,QAAQ,OAAO,EAAE;AACvB,OAAI,OAAO,WAAW,EAClB,QAAO,OAAO;IAAE;IAAS,QAAQ;IAAM;IAAQ,UAAU,EAAE;IAAS,CAAC;AAEzE,UAAO,OAAO;IAAE;IAAS,QAAQ;IAAS,WAAW;IAAS;IAAQ,UAAU,EAAE;IAAS,CAAC;;AAEhG,MAAI,cAAc,OAAO,EAAE;AACvB,OAAI,OAAO,KAAK,OAAO,CAAC,WAAW,EAC/B,QAAO,OAAO;IAAE;IAAS,QAAQ;IAAM,WAAW;IAAa;IAAQ,CAAC;AAE5E,UAAO,OAAO;IAAE;IAAS,QAAQ;IAAS,WAAW;IAAU;IAAQ,UAAU,EAAE;IAAE,CAAC;;AAE1F,MAAI,kBAAkB,KAAK;AACvB,OAAI,OAAO,SAAS,EAChB,QAAO,OAAO;IAAE;IAAS,QAAQ;IAAM,WAAW;IAAU;IAAQ,CAAC;AAEzE,UAAO,OAAO;IAAE;IAAS,QAAQ;IAAS,WAAW;IAAO;IAAQ,0BAAU,IAAI,KAAK;IAAE,CAAC;;AAE9F,MAAI,kBAAkB,KAAK;AACvB,OAAI,OAAO,SAAS,EAChB,QAAO,OAAO;IAAE;IAAS,QAAQ;IAAM,WAAW;IAAU;IAAQ,CAAC;AAEzE,UAAO,OAAO;IAAE;IAAS,QAAQ;IAAS,WAAW;IAAO;IAAQ,CAAC;;AAEzE,SAAO;GAAE;GAAS,QAAQ;GAAS,WAAW;GAAmB;GAAQ,CAAC;AAC1E,SAAO;GAAE;GAAS,QAAQ;GAAM,WAAW;GAAmB;GAAQ,CAAC;;CAElF,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_get_type = require('../utils/get-type.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/is-type.ts
|
|
7
|
+
const [isType, notIsType] = (0, hein_assertion_utils.createAssertion)({
|
|
8
|
+
messages: {
|
|
9
|
+
wrongType: "Expected {{= it.actual }} to be a(n) {{= it.expected }}",
|
|
10
|
+
not: `Expected {{= it.actual }} to not be a(n) {{= it.expected }}`
|
|
11
|
+
},
|
|
12
|
+
test: (report) => (value, expectedType) => {
|
|
13
|
+
const actualType = require_get_type.getType(value);
|
|
14
|
+
if (actualType !== expectedType) return report({
|
|
15
|
+
status: "notok",
|
|
16
|
+
messageId: "wrongType",
|
|
17
|
+
actual: actualType,
|
|
18
|
+
expected: expectedType,
|
|
19
|
+
noStringify: true
|
|
20
|
+
});
|
|
21
|
+
return report({
|
|
22
|
+
status: "ok",
|
|
23
|
+
messageId: "not",
|
|
24
|
+
actual: actualType,
|
|
25
|
+
expected: expectedType,
|
|
26
|
+
noStringify: true
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
exports.isType = isType;
|
|
33
|
+
exports.notIsType = notIsType;
|
|
34
|
+
//# sourceMappingURL=is-type.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-type.cjs","names":["getType"],"sources":["../../src/assert/is-type.ts"],"sourcesContent":["import { createAssertion } from 'hein-assertion-utils';\nimport { type ValueType, getType } from '../utils/get-type.js';\n\ninterface IsType {\n /**\n * check if value is of a specific type, nulls, NaN and arrays are specially handled\n * @param value\n * @param expectedType\n * @example isType('foo', 'string');\n * @example isType(1, 'number');\n * @example isType(1n, 'bigint');\n * @example isType(true, 'boolean');\n * @example isType(Symbol('foo'), 'symbol');\n * @example isType(undefined, 'undefined');\n * @example isType({}, 'object');\n * @example isType(() => {}, 'function');\n * @example isType(null, 'null');\n * @example isType(NaN, 'NaN');\n * @example isType([], 'array');\n */\n (value: unknown, expectedType: ValueType): void;\n /**\n * check if value is of a specific type, nulls, NaN and arrays are specially handled\n * @param value\n * @param expectedType\n * @example isType('foo', 'string');\n */\n (value: string, expectedType: 'string'): void;\n /**\n * check if value is of a specific type, nulls, NaN and arrays are specially handled\n * @param value\n * @param expectedType\n * @example isType(1, 'number');\n * @example isType(NaN, 'NaN');\n */\n (value: number, expectedType: 'number' | 'NaN'): void;\n /**\n * check if value is of a specific type, nulls, NaN and arrays are specially handled\n * @param value\n * @param expectedType\n * @example isType(1n, 'bigint');\n */\n (value: bigint, expectedType: 'bigint'): void;\n /**\n * check if value is of a specific type, nulls, NaN and arrays are specially handled\n * @param value\n * @param expectedType\n * @example isType(true, 'boolean');\n */\n (value: boolean, expectedType: 'boolean'): void;\n /**\n * check if value is of a specific type, nulls, NaN and arrays are specially handled\n * @param value\n * @param expectedType\n * @example isType(Symbol('foo'), 'symbol');\n */\n (value: symbol, expectedType: 'symbol'): void;\n /**\n * check if value is of a specific type, nulls, NaN and arrays are specially handled\n * @param value\n * @param expectedType\n * @example isType(Symbol('foo'), 'symbol');\n */\n (value: undefined, expectedType: 'undefined'): void;\n /**\n * check if value is of a specific type, nulls, NaN and arrays are specially handled\n * @param value\n * @param expectedType\n * @example isType({}, 'object');\n */\n (value: object, expectedType: 'object'): void;\n /**\n * check if value is of a specific type, nulls, NaN and arrays are specially handled\n * @param value\n * @param expectedType\n * @example isType(() => {}, 'function');\n */\n // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\n (value: Function, expectedType: 'function'): void;\n /**\n * check if value is of a specific type, nulls, NaN and arrays are specially handled\n * @param value\n * @param expectedType\n * @example isType(null, 'null');\n */\n (value: null, expectedType: 'null'): void;\n /**\n * check if value is of a specific type, nulls, NaN and arrays are specially handled\n * @param value\n * @param expectedType\n * @example isType([], 'array');\n */\n (value: any[], expectedType: 'array'): void;\n}\n\nexport const [isType, notIsType] = createAssertion({\n messages: {\n wrongType: 'Expected {{= it.actual }} to be a(n) {{= it.expected }}',\n not: `Expected {{= it.actual }} to not be a(n) {{= it.expected }}`\n },\n test:\n (report): IsType =>\n (value: any, expectedType: ValueType) => {\n const actualType = getType(value);\n if (actualType !== expectedType) {\n return report({\n status: 'notok',\n messageId: 'wrongType',\n actual: actualType,\n expected: expectedType,\n noStringify: true\n });\n }\n return report({\n status: 'ok',\n messageId: 'not',\n actual: actualType,\n expected: expectedType,\n noStringify: true\n });\n }\n});\n"],"mappings":";;;;;;AA+FA,MAAa,CAAC,QAAQ,uDAA6B;CAC/C,UAAU;EACN,WAAW;EACX,KAAK;EACR;CACD,OACK,YACA,OAAY,iBAA4B;EACrC,MAAM,aAAaA,yBAAQ,MAAM;AACjC,MAAI,eAAe,aACf,QAAO,OAAO;GACV,QAAQ;GACR,WAAW;GACX,QAAQ;GACR,UAAU;GACV,aAAa;GAChB,CAAC;AAEN,SAAO,OAAO;GACV,QAAQ;GACR,WAAW;GACX,QAAQ;GACR,UAAU;GACV,aAAa;GAChB,CAAC;;CAEb,CAAC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { ValueType } from "../utils/get-type.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/assert/is-type.d.ts
|
|
4
|
+
interface IsType {
|
|
5
|
+
/**
|
|
6
|
+
* check if value is of a specific type, nulls, NaN and arrays are specially handled
|
|
7
|
+
* @param value
|
|
8
|
+
* @param expectedType
|
|
9
|
+
* @example isType('foo', 'string');
|
|
10
|
+
* @example isType(1, 'number');
|
|
11
|
+
* @example isType(1n, 'bigint');
|
|
12
|
+
* @example isType(true, 'boolean');
|
|
13
|
+
* @example isType(Symbol('foo'), 'symbol');
|
|
14
|
+
* @example isType(undefined, 'undefined');
|
|
15
|
+
* @example isType({}, 'object');
|
|
16
|
+
* @example isType(() => {}, 'function');
|
|
17
|
+
* @example isType(null, 'null');
|
|
18
|
+
* @example isType(NaN, 'NaN');
|
|
19
|
+
* @example isType([], 'array');
|
|
20
|
+
*/
|
|
21
|
+
(value: unknown, expectedType: ValueType): void;
|
|
22
|
+
/**
|
|
23
|
+
* check if value is of a specific type, nulls, NaN and arrays are specially handled
|
|
24
|
+
* @param value
|
|
25
|
+
* @param expectedType
|
|
26
|
+
* @example isType('foo', 'string');
|
|
27
|
+
*/
|
|
28
|
+
(value: string, expectedType: 'string'): void;
|
|
29
|
+
/**
|
|
30
|
+
* check if value is of a specific type, nulls, NaN and arrays are specially handled
|
|
31
|
+
* @param value
|
|
32
|
+
* @param expectedType
|
|
33
|
+
* @example isType(1, 'number');
|
|
34
|
+
* @example isType(NaN, 'NaN');
|
|
35
|
+
*/
|
|
36
|
+
(value: number, expectedType: 'number' | 'NaN'): void;
|
|
37
|
+
/**
|
|
38
|
+
* check if value is of a specific type, nulls, NaN and arrays are specially handled
|
|
39
|
+
* @param value
|
|
40
|
+
* @param expectedType
|
|
41
|
+
* @example isType(1n, 'bigint');
|
|
42
|
+
*/
|
|
43
|
+
(value: bigint, expectedType: 'bigint'): void;
|
|
44
|
+
/**
|
|
45
|
+
* check if value is of a specific type, nulls, NaN and arrays are specially handled
|
|
46
|
+
* @param value
|
|
47
|
+
* @param expectedType
|
|
48
|
+
* @example isType(true, 'boolean');
|
|
49
|
+
*/
|
|
50
|
+
(value: boolean, expectedType: 'boolean'): void;
|
|
51
|
+
/**
|
|
52
|
+
* check if value is of a specific type, nulls, NaN and arrays are specially handled
|
|
53
|
+
* @param value
|
|
54
|
+
* @param expectedType
|
|
55
|
+
* @example isType(Symbol('foo'), 'symbol');
|
|
56
|
+
*/
|
|
57
|
+
(value: symbol, expectedType: 'symbol'): void;
|
|
58
|
+
/**
|
|
59
|
+
* check if value is of a specific type, nulls, NaN and arrays are specially handled
|
|
60
|
+
* @param value
|
|
61
|
+
* @param expectedType
|
|
62
|
+
* @example isType(Symbol('foo'), 'symbol');
|
|
63
|
+
*/
|
|
64
|
+
(value: undefined, expectedType: 'undefined'): void;
|
|
65
|
+
/**
|
|
66
|
+
* check if value is of a specific type, nulls, NaN and arrays are specially handled
|
|
67
|
+
* @param value
|
|
68
|
+
* @param expectedType
|
|
69
|
+
* @example isType({}, 'object');
|
|
70
|
+
*/
|
|
71
|
+
(value: object, expectedType: 'object'): void;
|
|
72
|
+
/**
|
|
73
|
+
* check if value is of a specific type, nulls, NaN and arrays are specially handled
|
|
74
|
+
* @param value
|
|
75
|
+
* @param expectedType
|
|
76
|
+
* @example isType(() => {}, 'function');
|
|
77
|
+
*/
|
|
78
|
+
(value: Function, expectedType: 'function'): void;
|
|
79
|
+
/**
|
|
80
|
+
* check if value is of a specific type, nulls, NaN and arrays are specially handled
|
|
81
|
+
* @param value
|
|
82
|
+
* @param expectedType
|
|
83
|
+
* @example isType(null, 'null');
|
|
84
|
+
*/
|
|
85
|
+
(value: null, expectedType: 'null'): void;
|
|
86
|
+
/**
|
|
87
|
+
* check if value is of a specific type, nulls, NaN and arrays are specially handled
|
|
88
|
+
* @param value
|
|
89
|
+
* @param expectedType
|
|
90
|
+
* @example isType([], 'array');
|
|
91
|
+
*/
|
|
92
|
+
(value: any[], expectedType: 'array'): void;
|
|
93
|
+
}
|
|
94
|
+
declare const isType: IsType, notIsType: IsType;
|
|
95
|
+
//#endregion
|
|
96
|
+
export { isType, notIsType };
|
|
97
|
+
//# sourceMappingURL=is-type.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-type.d.cts","names":[],"sources":["../../src/assert/is-type.ts"],"sourcesContent":[],"mappings":";;;UAGU,MAAA;;AAFqD;;;;;AA8F/D;;;;;;;;;;iCA3EmC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UA0DvB;;;;;;;;;;;;;;;;cAiBE,QAAM,mBAAW"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { ValueType } from "../utils/get-type.js";
|
|
2
|
+
|
|
3
|
+
//#region src/assert/is-type.d.ts
|
|
4
|
+
interface IsType {
|
|
5
|
+
/**
|
|
6
|
+
* check if value is of a specific type, nulls, NaN and arrays are specially handled
|
|
7
|
+
* @param value
|
|
8
|
+
* @param expectedType
|
|
9
|
+
* @example isType('foo', 'string');
|
|
10
|
+
* @example isType(1, 'number');
|
|
11
|
+
* @example isType(1n, 'bigint');
|
|
12
|
+
* @example isType(true, 'boolean');
|
|
13
|
+
* @example isType(Symbol('foo'), 'symbol');
|
|
14
|
+
* @example isType(undefined, 'undefined');
|
|
15
|
+
* @example isType({}, 'object');
|
|
16
|
+
* @example isType(() => {}, 'function');
|
|
17
|
+
* @example isType(null, 'null');
|
|
18
|
+
* @example isType(NaN, 'NaN');
|
|
19
|
+
* @example isType([], 'array');
|
|
20
|
+
*/
|
|
21
|
+
(value: unknown, expectedType: ValueType): void;
|
|
22
|
+
/**
|
|
23
|
+
* check if value is of a specific type, nulls, NaN and arrays are specially handled
|
|
24
|
+
* @param value
|
|
25
|
+
* @param expectedType
|
|
26
|
+
* @example isType('foo', 'string');
|
|
27
|
+
*/
|
|
28
|
+
(value: string, expectedType: 'string'): void;
|
|
29
|
+
/**
|
|
30
|
+
* check if value is of a specific type, nulls, NaN and arrays are specially handled
|
|
31
|
+
* @param value
|
|
32
|
+
* @param expectedType
|
|
33
|
+
* @example isType(1, 'number');
|
|
34
|
+
* @example isType(NaN, 'NaN');
|
|
35
|
+
*/
|
|
36
|
+
(value: number, expectedType: 'number' | 'NaN'): void;
|
|
37
|
+
/**
|
|
38
|
+
* check if value is of a specific type, nulls, NaN and arrays are specially handled
|
|
39
|
+
* @param value
|
|
40
|
+
* @param expectedType
|
|
41
|
+
* @example isType(1n, 'bigint');
|
|
42
|
+
*/
|
|
43
|
+
(value: bigint, expectedType: 'bigint'): void;
|
|
44
|
+
/**
|
|
45
|
+
* check if value is of a specific type, nulls, NaN and arrays are specially handled
|
|
46
|
+
* @param value
|
|
47
|
+
* @param expectedType
|
|
48
|
+
* @example isType(true, 'boolean');
|
|
49
|
+
*/
|
|
50
|
+
(value: boolean, expectedType: 'boolean'): void;
|
|
51
|
+
/**
|
|
52
|
+
* check if value is of a specific type, nulls, NaN and arrays are specially handled
|
|
53
|
+
* @param value
|
|
54
|
+
* @param expectedType
|
|
55
|
+
* @example isType(Symbol('foo'), 'symbol');
|
|
56
|
+
*/
|
|
57
|
+
(value: symbol, expectedType: 'symbol'): void;
|
|
58
|
+
/**
|
|
59
|
+
* check if value is of a specific type, nulls, NaN and arrays are specially handled
|
|
60
|
+
* @param value
|
|
61
|
+
* @param expectedType
|
|
62
|
+
* @example isType(Symbol('foo'), 'symbol');
|
|
63
|
+
*/
|
|
64
|
+
(value: undefined, expectedType: 'undefined'): void;
|
|
65
|
+
/**
|
|
66
|
+
* check if value is of a specific type, nulls, NaN and arrays are specially handled
|
|
67
|
+
* @param value
|
|
68
|
+
* @param expectedType
|
|
69
|
+
* @example isType({}, 'object');
|
|
70
|
+
*/
|
|
71
|
+
(value: object, expectedType: 'object'): void;
|
|
72
|
+
/**
|
|
73
|
+
* check if value is of a specific type, nulls, NaN and arrays are specially handled
|
|
74
|
+
* @param value
|
|
75
|
+
* @param expectedType
|
|
76
|
+
* @example isType(() => {}, 'function');
|
|
77
|
+
*/
|
|
78
|
+
(value: Function, expectedType: 'function'): void;
|
|
79
|
+
/**
|
|
80
|
+
* check if value is of a specific type, nulls, NaN and arrays are specially handled
|
|
81
|
+
* @param value
|
|
82
|
+
* @param expectedType
|
|
83
|
+
* @example isType(null, 'null');
|
|
84
|
+
*/
|
|
85
|
+
(value: null, expectedType: 'null'): void;
|
|
86
|
+
/**
|
|
87
|
+
* check if value is of a specific type, nulls, NaN and arrays are specially handled
|
|
88
|
+
* @param value
|
|
89
|
+
* @param expectedType
|
|
90
|
+
* @example isType([], 'array');
|
|
91
|
+
*/
|
|
92
|
+
(value: any[], expectedType: 'array'): void;
|
|
93
|
+
}
|
|
94
|
+
declare const isType: IsType, notIsType: IsType;
|
|
95
|
+
//#endregion
|
|
96
|
+
export { isType, notIsType };
|
|
97
|
+
//# sourceMappingURL=is-type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-type.d.ts","names":[],"sources":["../../src/assert/is-type.ts"],"sourcesContent":[],"mappings":";;;UAGU,MAAA;;AAFqD;;;;;AA8F/D;;;;;;;;;;iCA3EmC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UA0DvB;;;;;;;;;;;;;;;;cAiBE,QAAM,mBAAW"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { getType } from "../utils/get-type.js";
|
|
2
|
+
import { createAssertion } from "hein-assertion-utils";
|
|
3
|
+
|
|
4
|
+
//#region src/assert/is-type.ts
|
|
5
|
+
const [isType, notIsType] = createAssertion({
|
|
6
|
+
messages: {
|
|
7
|
+
wrongType: "Expected {{= it.actual }} to be a(n) {{= it.expected }}",
|
|
8
|
+
not: `Expected {{= it.actual }} to not be a(n) {{= it.expected }}`
|
|
9
|
+
},
|
|
10
|
+
test: (report) => (value, expectedType) => {
|
|
11
|
+
const actualType = getType(value);
|
|
12
|
+
if (actualType !== expectedType) return report({
|
|
13
|
+
status: "notok",
|
|
14
|
+
messageId: "wrongType",
|
|
15
|
+
actual: actualType,
|
|
16
|
+
expected: expectedType,
|
|
17
|
+
noStringify: true
|
|
18
|
+
});
|
|
19
|
+
return report({
|
|
20
|
+
status: "ok",
|
|
21
|
+
messageId: "not",
|
|
22
|
+
actual: actualType,
|
|
23
|
+
expected: expectedType,
|
|
24
|
+
noStringify: true
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
//#endregion
|
|
30
|
+
export { isType, notIsType };
|
|
31
|
+
//# sourceMappingURL=is-type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-type.js","names":[],"sources":["../../src/assert/is-type.ts"],"sourcesContent":["import { createAssertion } from 'hein-assertion-utils';\nimport { type ValueType, getType } from '../utils/get-type.js';\n\ninterface IsType {\n /**\n * check if value is of a specific type, nulls, NaN and arrays are specially handled\n * @param value\n * @param expectedType\n * @example isType('foo', 'string');\n * @example isType(1, 'number');\n * @example isType(1n, 'bigint');\n * @example isType(true, 'boolean');\n * @example isType(Symbol('foo'), 'symbol');\n * @example isType(undefined, 'undefined');\n * @example isType({}, 'object');\n * @example isType(() => {}, 'function');\n * @example isType(null, 'null');\n * @example isType(NaN, 'NaN');\n * @example isType([], 'array');\n */\n (value: unknown, expectedType: ValueType): void;\n /**\n * check if value is of a specific type, nulls, NaN and arrays are specially handled\n * @param value\n * @param expectedType\n * @example isType('foo', 'string');\n */\n (value: string, expectedType: 'string'): void;\n /**\n * check if value is of a specific type, nulls, NaN and arrays are specially handled\n * @param value\n * @param expectedType\n * @example isType(1, 'number');\n * @example isType(NaN, 'NaN');\n */\n (value: number, expectedType: 'number' | 'NaN'): void;\n /**\n * check if value is of a specific type, nulls, NaN and arrays are specially handled\n * @param value\n * @param expectedType\n * @example isType(1n, 'bigint');\n */\n (value: bigint, expectedType: 'bigint'): void;\n /**\n * check if value is of a specific type, nulls, NaN and arrays are specially handled\n * @param value\n * @param expectedType\n * @example isType(true, 'boolean');\n */\n (value: boolean, expectedType: 'boolean'): void;\n /**\n * check if value is of a specific type, nulls, NaN and arrays are specially handled\n * @param value\n * @param expectedType\n * @example isType(Symbol('foo'), 'symbol');\n */\n (value: symbol, expectedType: 'symbol'): void;\n /**\n * check if value is of a specific type, nulls, NaN and arrays are specially handled\n * @param value\n * @param expectedType\n * @example isType(Symbol('foo'), 'symbol');\n */\n (value: undefined, expectedType: 'undefined'): void;\n /**\n * check if value is of a specific type, nulls, NaN and arrays are specially handled\n * @param value\n * @param expectedType\n * @example isType({}, 'object');\n */\n (value: object, expectedType: 'object'): void;\n /**\n * check if value is of a specific type, nulls, NaN and arrays are specially handled\n * @param value\n * @param expectedType\n * @example isType(() => {}, 'function');\n */\n // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\n (value: Function, expectedType: 'function'): void;\n /**\n * check if value is of a specific type, nulls, NaN and arrays are specially handled\n * @param value\n * @param expectedType\n * @example isType(null, 'null');\n */\n (value: null, expectedType: 'null'): void;\n /**\n * check if value is of a specific type, nulls, NaN and arrays are specially handled\n * @param value\n * @param expectedType\n * @example isType([], 'array');\n */\n (value: any[], expectedType: 'array'): void;\n}\n\nexport const [isType, notIsType] = createAssertion({\n messages: {\n wrongType: 'Expected {{= it.actual }} to be a(n) {{= it.expected }}',\n not: `Expected {{= it.actual }} to not be a(n) {{= it.expected }}`\n },\n test:\n (report): IsType =>\n (value: any, expectedType: ValueType) => {\n const actualType = getType(value);\n if (actualType !== expectedType) {\n return report({\n status: 'notok',\n messageId: 'wrongType',\n actual: actualType,\n expected: expectedType,\n noStringify: true\n });\n }\n return report({\n status: 'ok',\n messageId: 'not',\n actual: actualType,\n expected: expectedType,\n noStringify: true\n });\n }\n});\n"],"mappings":";;;;AA+FA,MAAa,CAAC,QAAQ,aAAa,gBAAgB;CAC/C,UAAU;EACN,WAAW;EACX,KAAK;EACR;CACD,OACK,YACA,OAAY,iBAA4B;EACrC,MAAM,aAAa,QAAQ,MAAM;AACjC,MAAI,eAAe,aACf,QAAO,OAAO;GACV,QAAQ;GACR,WAAW;GACX,QAAQ;GACR,UAAU;GACV,aAAa;GAChB,CAAC;AAEN,SAAO,OAAO;GACV,QAAQ;GACR,WAAW;GACX,QAAQ;GACR,UAAU;GACV,aAAa;GAChB,CAAC;;CAEb,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
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-equal.ts
|
|
7
|
+
const [lessThanEqual, notLessThanEqual] = (0, hein_assertion_utils.createAssertion)({
|
|
8
|
+
messages: {
|
|
9
|
+
lesserThanEqual: "Expected {{= it.actual }} to be less than or equal to {{= it.expected }}",
|
|
10
|
+
not: "Expected {{= it.actual }} to not be less than or equal to {{= 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: "lesserThanEqual",
|
|
17
|
+
actual,
|
|
18
|
+
expected,
|
|
19
|
+
message,
|
|
20
|
+
noStringify: true
|
|
21
|
+
});
|
|
22
|
+
return report({
|
|
23
|
+
status: "ok",
|
|
24
|
+
actual,
|
|
25
|
+
expected,
|
|
26
|
+
message,
|
|
27
|
+
messageId: "not",
|
|
28
|
+
noStringify: true
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
//#endregion
|
|
34
|
+
exports.lessThanEqual = lessThanEqual;
|
|
35
|
+
exports.notLessThanEqual = notLessThanEqual;
|
|
36
|
+
//# sourceMappingURL=less-than-equal.cjs.map
|