Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add type checking to some actions #29

Merged
merged 5 commits into from
Jun 23, 2024
Merged

Add type checking to some actions #29

merged 5 commits into from
Jun 23, 2024

Conversation

grappigegovert
Copy link
Member

Add type checks to some actions.
Actions acting on wrong data types (e.x. $inc: ["a-string", 4], or $mul: ["$.aVariable", 3], where $.aVariable does not exist) will now do nothing, as it should.
I have not tested every possible combination of types in-game, but from the ones I've tested, I think it's safe to conclude that using $inc, $dec, and $mul with non-numbers does nothing.
Similarly, using $push, $pushunique, or $remove with non-arrays also does nothing.
The same is true if these actions are trying to use (context) variables that are undefined.

Should fix thepeacockproject/Peacock#479.

Copy link

codecov bot commented Jun 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Files Coverage Δ
src/handleEvent.ts 85.03% <100.00%> (+1.58%) ⬆️
src/index.ts 95.93% <100.00%> (+0.18%) ⬆️

... and 1 file with indirect coverage changes

Gotta reach those coverage targets :^)
Copy link
Member

@RDIL RDIL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@RDIL RDIL merged commit bbf3684 into main Jun 23, 2024
4 checks passed
@AnthonyFuller AnthonyFuller deleted the type-checking branch June 23, 2024 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

a.push is not a function errors
2 participants