Skip to content

Commit b3449ea

Browse files
goto-bus-stopaddaleax
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 c823d4b commit b3449ea

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

31263126
This API represents behavior similar to invoking the `typeof` Operator on
31273127
the object as defined in [Section 12.5.5][] of the ECMAScript Language
3128-
Specification. However, it has support for detecting an External value.
3128+
Specification. However, there are some differences:
3129+
3130+
1. It has support for detecting an External value.
3131+
2. It detects `null` as a separate type, while ECMAScript `typeof` would detect
3132+
`object`.
3133+
31293134
If `value` has a type that is invalid, an error is returned.
31303135

31313136
### napi_instanceof

0 commit comments

Comments
 (0)