Skip to content

Commit 7349223

Browse files
devsnektargos
authored andcommitted
doc: add util.types.isModuleNamespaceObject()
PR-URL: #20616 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
1 parent 56530f0 commit 7349223

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

doc/api/util.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1271,6 +1271,24 @@ util.types.isMapIterator(map.entries()); // Returns true
12711271
util.types.isMapIterator(map[Symbol.iterator]()); // Returns true
12721272
```
12731273

1274+
### util.types.isModuleNamespaceObject(value)
1275+
<!-- YAML
1276+
added: v10.0.0
1277+
-->
1278+
1279+
* Returns: {boolean}
1280+
1281+
Returns `true` if the value is an instance of a [Module Namespace Object][].
1282+
1283+
For example:
1284+
1285+
<!-- eslint-skip -->
1286+
```js
1287+
import * as ns from './a.js';
1288+
1289+
util.types.isModuleNamespaceObject(ns); // Returns true
1290+
```
1291+
12741292
### util.types.isNativeError(value)
12751293
<!-- YAML
12761294
added: v10.0.0
@@ -2111,6 +2129,7 @@ Deprecated predecessor of `console.log`.
21112129
[Custom promisified functions]: #util_custom_promisified_functions
21122130
[Customizing `util.inspect` colors]: #util_customizing_util_inspect_colors
21132131
[Internationalization]: intl.html
2132+
[Module Namespace Object]: https://tc39.github.io/ecma262/#sec-module-namespace-exotic-objects
21142133
[WHATWG Encoding Standard]: https://encoding.spec.whatwg.org/
21152134
[Common System Errors]: errors.html#errors_common_system_errors
21162135
[constructor]: https://developer.mozilla.org/en-US/JavaScript/Reference/Global_Objects/Object/constructor

0 commit comments

Comments
 (0)