File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -329,7 +329,7 @@ inline bool Value::IsTypedArray() const {
329
329
}
330
330
331
331
inline bool Value::IsObject () const {
332
- return Type () == napi_object;
332
+ return Type () == napi_object || IsFunction () ;
333
333
}
334
334
335
335
inline bool Value::IsFunction () const {
Original file line number Diff line number Diff line change @@ -7,6 +7,10 @@ test(require(`../build/${buildType}/binding.node`));
7
7
test ( require ( `../build/${ buildType } /binding_noexcept.node` ) ) ;
8
8
9
9
function test ( binding ) {
10
+ function isObject ( value ) {
11
+ return typeof value === 'object' || typeof value === 'function' ;
12
+ }
13
+
10
14
function detailedTypeOf ( value ) {
11
15
const type = typeof value ;
12
16
if ( type !== 'object' )
@@ -57,7 +61,7 @@ function test(binding) {
57
61
58
62
testValueList . forEach ( ( testValue ) => {
59
63
if ( testValue !== null && expectedType === 'object' ) {
60
- assert . strictEqual ( typeChecker ( testValue ) , typeof testValue === expectedType ) ;
64
+ assert . strictEqual ( typeChecker ( testValue ) , isObject ( testValue ) ) ;
61
65
} else {
62
66
assert . strictEqual ( typeChecker ( testValue ) , detailedTypeOf ( testValue ) === expectedType ) ;
63
67
}
You can’t perform that action at this time.
0 commit comments