Skip to content

Commit 64481c2

Browse files
goto-bus-stopGabriel Schulhof
authored and
Gabriel Schulhof
committed
doc: mention null special-case for napi_typeof
The documentation said `napi_typeof` is similar to the `typeof` operator, but the `typeof null` detects `'object'` while `napi_typeof(a_null_value)` detects `napi_null`. PR-URL: #34577 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Gabriel Schulhof <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: David Carlier <[email protected]>
1 parent 0be93ee commit 64481c2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

doc/api/n-api.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -3168,7 +3168,12 @@ Returns `napi_ok` if the API succeeded.
31683168

31693169
This API represents behavior similar to invoking the `typeof` Operator on
31703170
the object as defined in [Section 12.5.5][] of the ECMAScript Language
3171-
Specification. However, it has support for detecting an External value.
3171+
Specification. However, there are some differences:
3172+
3173+
1. It has support for detecting an External value.
3174+
2. It detects `null` as a separate type, while ECMAScript `typeof` would detect
3175+
`object`.
3176+
31723177
If `value` has a type that is invalid, an error is returned.
31733178

31743179
### napi_instanceof

0 commit comments

Comments
 (0)