Open niightly opened 7 months ago
Hi, I'm not seeing joi being used in your repro, did you forget to push something?
I tried on my side with your prototype, I think you're running into risks with many libraries with this. If you have control over this, you should define your extensions this way:
Object.defineProperty(Object.prototype, "key_from", {
enumerable: false,
value: function (value) {
const keys = Object.keys(this);
if (keys.length === 0) {
return null;
}
return keys.find((key) => this[key] == value);
},
})
I'm honestly not sure it's worth fixing in joi.
Runtime
node
Runtime version
v20.12.1
Module version
17.12.3
Last module version without issue
14.3.1
Used with
standalone
Any other relevant information
No response
What are you trying to achieve or the steps to reproduce?
I took the liberty to create a proof of concept => https://stackblitz.com/edit/nodejs-server-1krq6c?file=server.js. I was upgrading an application (too old) and because of this that are several prototypes implemented that are affecting the new versions of joi.
What was the result you got?
The error below:
What result did you expect?
the same behavior as the older versions, I was able to use joi normally without error