Skip to content

Commit cb9e66e

Browse files
author
cloudhead
committed
(new) added assert.isNull, and made isObject more robust
1 parent cf459bc commit cb9e66e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/vows/macros.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ assert.isNaN = function (actual, message) {
7474
assert.fail(actual, 'NaN', message || "expected {actual} to be NaN", "isNaN", assert.isNaN);
7575
}
7676
};
77+
assert.isNull = function (actual, message) {
78+
if (actual !== null) {
79+
assert.fail(actual, 'null', message || "expected {actual} to be null", "===", assert.isNull);
80+
}
81+
};
7782
assert.isString = function (actual, message) {
7883
assertTypeOf(actual, 'string', message || "expected {actual} to be a String", assert.isString);
7984
};
@@ -102,7 +107,7 @@ function isString (obj) {
102107
}
103108

104109
function isObject (obj) {
105-
return typeof(obj) === 'object' && obj instanceof Object && !isArray(obj);
110+
return typeof(obj) === 'object' && obj && !isArray(obj);
106111
}
107112

108113
// A better `typeof`

0 commit comments

Comments
 (0)