Open pano9000 opened 1 year ago
Related PR; https://github.com/validatorjs/validator.js/pull/2099
I think that Babel can take care of this, but I don't know if this project has the proper configuration for this.
@WikiRik thank you for the comment, and making me aware about #2099 I will make a comment there, about my thoughts here
Hello all,
I recently noticed the
includes
function in theutil
folder, which was originally added in 2018, as some sort of polyfill for theArray.prototype.includes()
method:https://github.com/validatorjs/validator.js/commit/9457642473d3e282310a829754929463e6998941 - "Created includes function for array to cater older browsers"
I see a few issues with this in the meantime:
includes
function is not applicable to these anymore)Array.prototype.some()
method is a lot slower thanArray.prototype.includes()
: I ran a few local benchmarks with benchmark package, and the nativeArray.prototype.includes()
method was always 2-4x times fasterSo question here is: Am I wrong about Babel? If not: Are there any reason to still keep this includes function? That util function is not exported, so there also shouldn't be any backwards compatibility issues, that we need to keep in mind.
What are your thoughts? Happy to take care about the PR for this then
Kind regards,
Pano