Adding a simple type guard to avoid reaching uncaught exceptions by calling .includes on a potentially any type of object.
⚠️ I am not 100% sure what is the idea of this function but it looks like it is trying to not attach hCaptcha events in certain cases. That brings me to the question if there are other cases where that condition should be triggered. E.g. file upload submissions.
In other words, this PR only makes the code not crash, but has no impact on the current logic which might be missing some business cases.
Adding a simple type guard to avoid reaching uncaught exceptions by calling
.includes
on a potentially any type of object.⚠️ I am not 100% sure what is the idea of this function but it looks like it is trying to not attach hCaptcha events in certain cases. That brings me to the question if there are other cases where that condition should be triggered. E.g. file upload submissions.
In other words, this PR only makes the code not crash, but has no impact on the current logic which might be missing some business cases.
Related Issue: Related to https://github.com/hCaptcha/hcaptcha-wordpress-plugin/issues/325