Skip to content

Commit

Permalink
doc: mention null special-case for napi_typeof
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
goto-bus-stop authored and codebytere committed Aug 5, 2020
1 parent 10dd7a0 commit 0a9389b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion doc/api/n-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -3165,7 +3165,12 @@ Returns `napi_ok` if the API succeeded.

This API represents behavior similar to invoking the `typeof` Operator on
the object as defined in [Section 12.5.5][] of the ECMAScript Language
Specification. However, it has support for detecting an External value.
Specification. However, there are some differences:

1. It has support for detecting an External value.
2. It detects `null` as a separate type, while ECMAScript `typeof` would detect
`object`.

If `value` has a type that is invalid, an error is returned.

### napi_instanceof
Expand Down

0 comments on commit 0a9389b

Please sign in to comment.