Skip to content

Commit ab3c233

Browse files
committed
Add object equal validator in value filter.
1 parent 50a9941 commit ab3c233

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/validators/value.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
var util = require('../util');
2+
13
/**
24
* Value validator
35
*
@@ -18,9 +20,10 @@ function isValid(data, model) {
1820

1921
// Data is different than equals
2022
if (model.value.eq) {
23+
// Same data type and different values
2124
if (typeof (data) === typeof (model.value.eq) && data !== model.value.eq) {
22-
// Same data type and different values
23-
return false;
25+
// If object, return util.compare. Else, return false.
26+
return (typeof data === 'object') ? util.equal(data, model.value.eq) : false;
2427
}
2528
// Different types: Try to convert one to other.
2629
var parsed = data;

0 commit comments

Comments
 (0)