diff options
author | Renée Kooi <renee@kooi.me> | 2020-07-31 14:54:24 +0300 |
---|---|---|
committer | Gabriel Schulhof <gabriel.schulhof@intel.com> | 2020-08-02 21:57:47 +0300 |
commit | 64481c2b133f9314c560c635f06da1abfaf3123a (patch) | |
tree | cee6ca84af238e4ec85a0bd2e662540a2b34c08e /doc/api/n-api.md | |
parent | 0be93eeb335d48636a4e338ef7a501cdb3beabd4 (diff) |
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: https://github.com/nodejs/node/pull/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>
Diffstat (limited to 'doc/api/n-api.md')
-rw-r--r-- | doc/api/n-api.md | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/doc/api/n-api.md b/doc/api/n-api.md index 6b847193623..5a90f4c81fc 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -3168,7 +3168,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 |