Skip to content

Commit 0a9389b

Browse files
goto-bus-stopcodebytere
authored andcommitted
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 10dd7a0 commit 0a9389b

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
@@ -3165,7 +3165,12 @@ Returns `napi_ok` if the API succeeded.
31653165

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

31713176
### napi_instanceof

0 commit comments

Comments
 (0)