Skip to content

Commit 64481c2

Browse files
goto-bus-stopGabriel Schulhof
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 <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com>
1 parent 0be93ee commit 64481c2

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

doc/api/n-api.md

Lines changed: 6 additions & 1 deletion
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)