Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ function isBuffer(x) {
function objEquiv(a, b, opts) {
/* eslint max-statements: [2, 50] */
var i, key;
if (typeof a !== typeof b) { return false; }
if (isUndefinedOrNull(a) || isUndefinedOrNull(b)) { return false; }

// an identical 'prototype' property.
Expand Down
12 changes: 12 additions & 0 deletions test/cmp.js
Original file line number Diff line number Diff line change
Expand Up @@ -316,3 +316,15 @@ test('arrays and objects', function (t) {

t.end();
});

test('functions', function (t) {
function f() {}

t.ok(equal(f, f), 'a function is equal to itself');
t.ok(equal(f, f, { strict: true }), 'strict: a function is equal to itself');

t.notOk(equal(function () {}, function () {}), 'two different functions are never equal');
t.notOk(equal(function () {}, function () {}, { strict: true }), 'strict: two different functions are never equal');

t.end();
});