Skip to content

Commit d695088

Browse files
author
Semigradsky
committed
Fixed christianalfoni#298: RangeError: Maximum call stack size exceeded with custom validator
1 parent 3cdcdf5 commit d695088

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/utils.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ module.exports = {
3232
return false;
3333
} else if (Array.isArray(a)) {
3434
return !this.arraysDiffer(a, b);
35+
} else if (typeof a === 'function') {
36+
return a.toString() === b.toString();
3537
} else if (typeof a === 'object' && a !== null && b !== null) {
3638
return !this.objectsDiffer(a, b);
3739
}

tests/Utils-spec.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ export default {
2525
test.equal(utils.isSame(objA, objH), false);
2626
test.equal(utils.isSame(objG, objA), false);
2727

28+
test.equal(utils.isSame(() => {}, () => {}), true);
29+
test.equal(utils.isSame(objA, () => {}), false);
30+
test.equal(utils.isSame(() => {}, objA), false);
31+
2832
test.done();
2933

3034
}

0 commit comments

Comments
 (0)