validate.js icon indicating copy to clipboard operation
validate.js copied to clipboard

Object values not checked in validate.contains()

Open liikinn opened this issue 6 years ago • 0 comments

Is it intended that validate.contains() only checks the properties for objects?

For example

validate.contains({3: '1'}, '1')
// false

validate.contains({1: '1'}, '1')
// true

This is caused by line 436 in validate.js because Javascript's in operator only checks the properties of an object.

https://github.com/ansman/validate.js/blob/cccc345aa70cda2a59bccdbc240ffd52b7528bda/validate.js#L436

Perhaps it would be better to also check object values? Or maybe add a note to the documentation that the method does not check object values.

liikinn avatar Jul 31 '18 13:07 liikinn