Skip to content

Commit

Permalink
doc: add added: information for modules
Browse files Browse the repository at this point in the history
PR-URL: #8250
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Bryan English <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
lpinca authored and MylesBorins committed Oct 26, 2016
1 parent a48469f commit b3617fc
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions doc/api/modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,9 @@ to the module, such as:
module's absolute filename and directory path.

## The `module` Object
<!-- YAML
added: v0.1.16
-->

<!-- type=var -->
<!-- name=module -->
Expand All @@ -463,12 +466,18 @@ also accessible via the `exports` module-global. `module` isn't actually
a global but rather local to each module.

### module.children
<!-- YAML
added: v0.1.16
-->

* {Array}

The module objects required by this one.

### module.exports
<!-- YAML
added: v0.1.16
-->

* {Object}

Expand Down Expand Up @@ -521,6 +530,9 @@ console.log(x.a);
```

#### exports alias
<!-- YAML
added: v0.1.16
-->

The `exports` variable that is available within a module starts as a reference
to `module.exports`. As with any variable, if you assign a new value to it, it
Expand All @@ -546,32 +558,47 @@ As a guideline, if the relationship between `exports` and `module.exports`
seems like magic to you, ignore `exports` and only use `module.exports`.

### module.filename
<!-- YAML
added: v0.1.16
-->

* {String}

The fully resolved filename to the module.

### module.id
<!-- YAML
added: v0.1.16
-->

* {String}

The identifier for the module. Typically this is the fully resolved
filename.

### module.loaded
<!-- YAML
added: v0.1.16
-->

* {Boolean}

Whether or not the module is done loading, or is in the process of
loading.

### module.parent
<!-- YAML
added: v0.1.16
-->

* {Object} Module object

The module that first required this one.

### module.require(id)
<!-- YAML
added: v0.5.1
-->

* `id` {String}
* Return: {Object} `module.exports` from the resolved module
Expand Down

0 comments on commit b3617fc

Please sign in to comment.