{
  "source": "doc/api/modules.md",
  "modules": [
    {
      "textRaw": "Modules",
      "name": "module",
      "stability": 2,
      "stabilityText": "Stable",
      "desc": "<p>Node.js has a simple module loading system.  In Node.js, files and modules\nare in one-to-one correspondence (each file is treated as a separate module).</p>\n<p>As an example, consider a file named <code>foo.js</code>:</p>\n<pre><code class=\"lang-js\">const circle = require(&#39;./circle.js&#39;);\nconsole.log(`The area of a circle of radius 4 is ${circle.area(4)}`);\n</code></pre>\n<p>On the first line, <code>foo.js</code> loads the module <code>circle.js</code> that is in the same\ndirectory as <code>foo.js</code>.</p>\n<p>Here are the contents of <code>circle.js</code>:</p>\n<pre><code class=\"lang-js\">const { PI } = Math;\n\nexports.area = (r) =&gt; PI * r * r;\n\nexports.circumference = (r) =&gt; 2 * PI * r;\n</code></pre>\n<p>The module <code>circle.js</code> has exported the functions <code>area()</code> and\n<code>circumference()</code>.  To add functions and objects to the root of your module,\nyou can add them to the special <code>exports</code> object.</p>\n<p>Variables local to the module will be private, because the module is wrapped\nin a function by Node.js (see <a href=\"#modules_the_module_wrapper\">module wrapper</a>).\nIn this example, the variable <code>PI</code> is private to <code>circle.js</code>.</p>\n<p>If you want the root of your module&#39;s export to be a function (such as a\nconstructor) or if you want to export a complete object in one assignment\ninstead of building it one property at a time, assign it to <code>module.exports</code>\ninstead of <code>exports</code>.</p>\n<p>Below, <code>bar.js</code> makes use of the <code>square</code> module, which exports a constructor:</p>\n<pre><code class=\"lang-js\">const square = require(&#39;./square.js&#39;);\nconst mySquare = square(2);\nconsole.log(`The area of my square is ${mySquare.area()}`);\n</code></pre>\n<p>The <code>square</code> module is defined in <code>square.js</code>:</p>\n<pre><code class=\"lang-js\">// assigning to exports will not modify module, must use module.exports\nmodule.exports = (width) =&gt; {\n  return {\n    area: () =&gt; width * width\n  };\n};\n</code></pre>\n<p>The module system is implemented in the <code>require(&#39;module&#39;)</code> module.</p>\n",
      "miscs": [
        {
          "textRaw": "Accessing the main module",
          "name": "Accessing the main module",
          "type": "misc",
          "desc": "<p>When a file is run directly from Node.js, <code>require.main</code> is set to its\n<code>module</code>. That means that you can determine whether a file has been run\ndirectly by testing <code>require.main === module</code>.</p>\n<p>For a file <code>foo.js</code>, this will be <code>true</code> if run via <code>node foo.js</code>, but\n<code>false</code> if run by <code>require(&#39;./foo&#39;)</code>.</p>\n<p>Because <code>module</code> provides a <code>filename</code> property (normally equivalent to\n<code>__filename</code>), the entry point of the current application can be obtained\nby checking <code>require.main.filename</code>.</p>\n"
        },
        {
          "textRaw": "Addenda: Package Manager Tips",
          "name": "Addenda: Package Manager Tips",
          "type": "misc",
          "desc": "<p>The semantics of Node.js&#39;s <code>require()</code> function were designed to be general\nenough to support a number of reasonable directory structures. Package manager\nprograms such as <code>dpkg</code>, <code>rpm</code>, and <code>npm</code> will hopefully find it possible to\nbuild native packages from Node.js modules without modification.</p>\n<p>Below we give a suggested directory structure that could work:</p>\n<p>Let&#39;s say that we wanted to have the folder at\n<code>/usr/lib/node/&lt;some-package&gt;/&lt;some-version&gt;</code> hold the contents of a\nspecific version of a package.</p>\n<p>Packages can depend on one another. In order to install package <code>foo</code>, you\nmay have to install a specific version of package <code>bar</code>.  The <code>bar</code> package\nmay itself have dependencies, and in some cases, these dependencies may even\ncollide or form cycles.</p>\n<p>Since Node.js looks up the <code>realpath</code> of any modules it loads (that is,\nresolves symlinks), and then looks for their dependencies in the <code>node_modules</code>\nfolders as described <a href=\"#modules_loading_from_node_modules_folders\">here</a>, this\nsituation is very simple to resolve with the following architecture:</p>\n<ul>\n<li><code>/usr/lib/node/foo/1.2.3/</code> - Contents of the <code>foo</code> package, version 1.2.3.</li>\n<li><code>/usr/lib/node/bar/4.3.2/</code> - Contents of the <code>bar</code> package that <code>foo</code>\ndepends on.</li>\n<li><code>/usr/lib/node/foo/1.2.3/node_modules/bar</code> - Symbolic link to\n<code>/usr/lib/node/bar/4.3.2/</code>.</li>\n<li><code>/usr/lib/node/bar/4.3.2/node_modules/*</code> - Symbolic links to the packages\nthat <code>bar</code> depends on.</li>\n</ul>\n<p>Thus, even if a cycle is encountered, or if there are dependency\nconflicts, every module will be able to get a version of its dependency\nthat it can use.</p>\n<p>When the code in the <code>foo</code> package does <code>require(&#39;bar&#39;)</code>, it will get the\nversion that is symlinked into <code>/usr/lib/node/foo/1.2.3/node_modules/bar</code>.\nThen, when the code in the <code>bar</code> package calls <code>require(&#39;quux&#39;)</code>, it&#39;ll get\nthe version that is symlinked into\n<code>/usr/lib/node/bar/4.3.2/node_modules/quux</code>.</p>\n<p>Furthermore, to make the module lookup process even more optimal, rather\nthan putting packages directly in <code>/usr/lib/node</code>, we could put them in\n<code>/usr/lib/node_modules/&lt;name&gt;/&lt;version&gt;</code>.  Then Node.js will not bother\nlooking for missing dependencies in <code>/usr/node_modules</code> or <code>/node_modules</code>.</p>\n<p>In order to make modules available to the Node.js REPL, it might be useful to\nalso add the <code>/usr/lib/node_modules</code> folder to the <code>$NODE_PATH</code> environment\nvariable.  Since the module lookups using <code>node_modules</code> folders are all\nrelative, and based on the real path of the files making the calls to\n<code>require()</code>, the packages themselves can be anywhere.</p>\n"
        },
        {
          "textRaw": "All Together...",
          "name": "All Together...",
          "type": "misc",
          "desc": "<p>To get the exact filename that will be loaded when <code>require()</code> is called, use\nthe <code>require.resolve()</code> function.</p>\n<p>Putting together all of the above, here is the high-level algorithm\nin pseudocode of what <code>require.resolve()</code> does:</p>\n<pre><code class=\"lang-txt\">require(X) from module at path Y\n1. If X is a core module,\n   a. return the core module\n   b. STOP\n2. If X begins with &#39;/&#39;\n   a. set Y to be the filesystem root\n3. If X begins with &#39;./&#39; or &#39;/&#39; or &#39;../&#39;\n   a. LOAD_AS_FILE(Y + X)\n   b. LOAD_AS_DIRECTORY(Y + X)\n4. LOAD_NODE_MODULES(X, dirname(Y))\n5. THROW &quot;not found&quot;\n\nLOAD_AS_FILE(X)\n1. If X is a file, load X as JavaScript text.  STOP\n2. If X.js is a file, load X.js as JavaScript text.  STOP\n3. If X.json is a file, parse X.json to a JavaScript Object.  STOP\n4. If X.node is a file, load X.node as binary addon.  STOP\n\nLOAD_INDEX(X)\n1. If X/index.js is a file, load X/index.js as JavaScript text.  STOP\n2. If X/index.json is a file, parse X/index.json to a JavaScript object. STOP\n3. If X/index.node is a file, load X/index.node as binary addon.  STOP\n\nLOAD_AS_DIRECTORY(X)\n1. If X/package.json is a file,\n   a. Parse X/package.json, and look for &quot;main&quot; field.\n   b. let M = X + (json main field)\n   c. LOAD_AS_FILE(M)\n   d. LOAD_INDEX(M)\n2. LOAD_INDEX(X)\n\nLOAD_NODE_MODULES(X, START)\n1. let DIRS=NODE_MODULES_PATHS(START)\n2. for each DIR in DIRS:\n   a. LOAD_AS_FILE(DIR/X)\n   b. LOAD_AS_DIRECTORY(DIR/X)\n\nNODE_MODULES_PATHS(START)\n1. let PARTS = path split(START)\n2. let I = count of PARTS - 1\n3. let DIRS = []\n4. while I &gt;= 0,\n   a. if PARTS[I] = &quot;node_modules&quot; CONTINUE\n   b. DIR = path join(PARTS[0 .. I] + &quot;node_modules&quot;)\n   c. DIRS = DIRS + DIR\n   d. let I = I - 1\n5. return DIRS\n</code></pre>\n"
        },
        {
          "textRaw": "Caching",
          "name": "Caching",
          "type": "misc",
          "desc": "<p>Modules are cached after the first time they are loaded.  This means\n(among other things) that every call to <code>require(&#39;foo&#39;)</code> will get\nexactly the same object returned, if it would resolve to the same file.</p>\n<p>Multiple calls to <code>require(&#39;foo&#39;)</code> may not cause the module code to be\nexecuted multiple times.  This is an important feature.  With it,\n&quot;partially done&quot; objects can be returned, thus allowing transitive\ndependencies to be loaded even when they would cause cycles.</p>\n<p>If you want to have a module execute code multiple times, then export a\nfunction, and call that function.</p>\n",
          "miscs": [
            {
              "textRaw": "Module Caching Caveats",
              "name": "Module Caching Caveats",
              "type": "misc",
              "desc": "<p>Modules are cached based on their resolved filename.  Since modules may\nresolve to a different filename based on the location of the calling\nmodule (loading from <code>node_modules</code> folders), it is not a <em>guarantee</em>\nthat <code>require(&#39;foo&#39;)</code> will always return the exact same object, if it\nwould resolve to different files.</p>\n<p>Additionally, on case-insensitive file systems or operating systems, different\nresolved filenames can point to the same file, but the cache will still treat\nthem as different modules and will reload the file multiple times. For example,\n<code>require(&#39;./foo&#39;)</code> and <code>require(&#39;./FOO&#39;)</code> return two different objects,\nirrespective of whether or not <code>./foo</code> and <code>./FOO</code> are the same file.</p>\n"
            }
          ]
        },
        {
          "textRaw": "Core Modules",
          "name": "Core Modules",
          "type": "misc",
          "desc": "<p>Node.js has several modules compiled into the binary.  These modules are\ndescribed in greater detail elsewhere in this documentation.</p>\n<p>The core modules are defined within Node.js&#39;s source and are located in the\n<code>lib/</code> folder.</p>\n<p>Core modules are always preferentially loaded if their identifier is\npassed to <code>require()</code>.  For instance, <code>require(&#39;http&#39;)</code> will always\nreturn the built in HTTP module, even if there is a file by that name.</p>\n"
        },
        {
          "textRaw": "Cycles",
          "name": "Cycles",
          "type": "misc",
          "desc": "<p>When there are circular <code>require()</code> calls, a module might not have finished\nexecuting when it is returned.</p>\n<p>Consider this situation:</p>\n<p><code>a.js</code>:</p>\n<pre><code class=\"lang-js\">console.log(&#39;a starting&#39;);\nexports.done = false;\nconst b = require(&#39;./b.js&#39;);\nconsole.log(&#39;in a, b.done = %j&#39;, b.done);\nexports.done = true;\nconsole.log(&#39;a done&#39;);\n</code></pre>\n<p><code>b.js</code>:</p>\n<pre><code class=\"lang-js\">console.log(&#39;b starting&#39;);\nexports.done = false;\nconst a = require(&#39;./a.js&#39;);\nconsole.log(&#39;in b, a.done = %j&#39;, a.done);\nexports.done = true;\nconsole.log(&#39;b done&#39;);\n</code></pre>\n<p><code>main.js</code>:</p>\n<pre><code class=\"lang-js\">console.log(&#39;main starting&#39;);\nconst a = require(&#39;./a.js&#39;);\nconst b = require(&#39;./b.js&#39;);\nconsole.log(&#39;in main, a.done=%j, b.done=%j&#39;, a.done, b.done);\n</code></pre>\n<p>When <code>main.js</code> loads <code>a.js</code>, then <code>a.js</code> in turn loads <code>b.js</code>.  At that\npoint, <code>b.js</code> tries to load <code>a.js</code>.  In order to prevent an infinite\nloop, an <strong>unfinished copy</strong> of the <code>a.js</code> exports object is returned to the\n<code>b.js</code> module.  <code>b.js</code> then finishes loading, and its <code>exports</code> object is\nprovided to the <code>a.js</code> module.</p>\n<p>By the time <code>main.js</code> has loaded both modules, they&#39;re both finished.\nThe output of this program would thus be:</p>\n<pre><code class=\"lang-txt\">$ node main.js\nmain starting\na starting\nb starting\nin b, a.done = false\nb done\nin a, b.done = true\na done\nin main, a.done=true, b.done=true\n</code></pre>\n<p>If you have cyclic module dependencies in your program, make sure to\nplan accordingly.</p>\n"
        },
        {
          "textRaw": "File Modules",
          "name": "File Modules",
          "type": "misc",
          "desc": "<p>If the exact filename is not found, then Node.js will attempt to load the\nrequired filename with the added extensions: <code>.js</code>, <code>.json</code>, and finally\n<code>.node</code>.</p>\n<p><code>.js</code> files are interpreted as JavaScript text files, and <code>.json</code> files are\nparsed as JSON text files. <code>.node</code> files are interpreted as compiled addon\nmodules loaded with <code>dlopen</code>.</p>\n<p>A required module prefixed with <code>&#39;/&#39;</code> is an absolute path to the file.  For\nexample, <code>require(&#39;/home/marco/foo.js&#39;)</code> will load the file at\n<code>/home/marco/foo.js</code>.</p>\n<p>A required module prefixed with <code>&#39;./&#39;</code> is relative to the file calling\n<code>require()</code>. That is, <code>circle.js</code> must be in the same directory as <code>foo.js</code> for\n<code>require(&#39;./circle&#39;)</code> to find it.</p>\n<p>Without a leading &#39;/&#39;, &#39;./&#39;, or &#39;../&#39; to indicate a file, the module must\neither be a core module or is loaded from a <code>node_modules</code> folder.</p>\n<p>If the given path does not exist, <code>require()</code> will throw an <a href=\"errors.html#errors_class_error\"><code>Error</code></a> with its\n<code>code</code> property set to <code>&#39;MODULE_NOT_FOUND&#39;</code>.</p>\n"
        },
        {
          "textRaw": "Folders as Modules",
          "name": "Folders as Modules",
          "type": "misc",
          "desc": "<p>It is convenient to organize programs and libraries into self-contained\ndirectories, and then provide a single entry point to that library.\nThere are three ways in which a folder may be passed to <code>require()</code> as\nan argument.</p>\n<p>The first is to create a <code>package.json</code> file in the root of the folder,\nwhich specifies a <code>main</code> module.  An example package.json file might\nlook like this:</p>\n<pre><code class=\"lang-json\">{ &quot;name&quot; : &quot;some-library&quot;,\n  &quot;main&quot; : &quot;./lib/some-library.js&quot; }\n</code></pre>\n<p>If this was in a folder at <code>./some-library</code>, then\n<code>require(&#39;./some-library&#39;)</code> would attempt to load\n<code>./some-library/lib/some-library.js</code>.</p>\n<p>This is the extent of Node.js&#39;s awareness of package.json files.</p>\n<p>Note: If the file specified by the <code>&quot;main&quot;</code> entry of <code>package.json</code> is missing\nand can not be resolved, Node.js will report the entire module as missing with\nthe default error:</p>\n<pre><code class=\"lang-txt\">Error: Cannot find module &#39;some-library&#39;\n</code></pre>\n<p>If there is no package.json file present in the directory, then Node.js\nwill attempt to load an <code>index.js</code> or <code>index.node</code> file out of that\ndirectory.  For example, if there was no package.json file in the above\nexample, then <code>require(&#39;./some-library&#39;)</code> would attempt to load:</p>\n<ul>\n<li><code>./some-library/index.js</code></li>\n<li><code>./some-library/index.node</code></li>\n</ul>\n"
        },
        {
          "textRaw": "Loading from `node_modules` Folders",
          "name": "Loading from `node_modules` Folders",
          "type": "misc",
          "desc": "<p>If the module identifier passed to <code>require()</code> is not a\n<a href=\"#modules_core_modules\">core</a> module, and does not begin with <code>&#39;/&#39;</code>, <code>&#39;../&#39;</code>, or\n<code>&#39;./&#39;</code>, then Node.js starts at the parent directory of the current module, and\nadds <code>/node_modules</code>, and attempts to load the module from that location. Node\nwill not append <code>node_modules</code> to a path already ending in <code>node_modules</code>.</p>\n<p>If it is not found there, then it moves to the parent directory, and so\non, until the root of the file system is reached.</p>\n<p>For example, if the file at <code>&#39;/home/ry/projects/foo.js&#39;</code> called\n<code>require(&#39;bar.js&#39;)</code>, then Node.js would look in the following locations, in\nthis order:</p>\n<ul>\n<li><code>/home/ry/projects/node_modules/bar.js</code></li>\n<li><code>/home/ry/node_modules/bar.js</code></li>\n<li><code>/home/node_modules/bar.js</code></li>\n<li><code>/node_modules/bar.js</code></li>\n</ul>\n<p>This allows programs to localize their dependencies, so that they do not\nclash.</p>\n<p>You can require specific files or sub modules distributed with a module by\nincluding a path suffix after the module name. For instance\n<code>require(&#39;example-module/path/to/file&#39;)</code> would resolve <code>path/to/file</code>\nrelative to where <code>example-module</code> is located. The suffixed path follows the\nsame module resolution semantics.</p>\n"
        },
        {
          "textRaw": "Loading from the global folders",
          "name": "Loading from the global folders",
          "type": "misc",
          "desc": "<p>If the <code>NODE_PATH</code> environment variable is set to a colon-delimited list\nof absolute paths, then Node.js will search those paths for modules if they\nare not found elsewhere.  (Note: On Windows, <code>NODE_PATH</code> is delimited by\nsemicolons instead of colons.)</p>\n<p><code>NODE_PATH</code> was originally created to support loading modules from\nvarying paths before the current <a href=\"#modules_all_together\">module resolution</a> algorithm was frozen.</p>\n<p><code>NODE_PATH</code> is still supported, but is less necessary now that the Node.js\necosystem has settled on a convention for locating dependent modules.\nSometimes deployments that rely on <code>NODE_PATH</code> show surprising behavior\nwhen people are unaware that <code>NODE_PATH</code> must be set.  Sometimes a\nmodule&#39;s dependencies change, causing a different version (or even a\ndifferent module) to be loaded as the <code>NODE_PATH</code> is searched.</p>\n<p>Additionally, Node.js will search in the following locations:</p>\n<ul>\n<li>1: <code>$HOME/.node_modules</code></li>\n<li>2: <code>$HOME/.node_libraries</code></li>\n<li>3: <code>$PREFIX/lib/node</code></li>\n</ul>\n<p>Where <code>$HOME</code> is the user&#39;s home directory, and <code>$PREFIX</code> is Node.js&#39;s\nconfigured <code>node_prefix</code>.</p>\n<p>These are mostly for historic reasons.  <strong>You are highly encouraged\nto place your dependencies locally in <code>node_modules</code> folders.</strong>  They\nwill be loaded faster, and more reliably.</p>\n"
        },
        {
          "textRaw": "The module wrapper",
          "name": "The module wrapper",
          "type": "misc",
          "desc": "<p>Before a module&#39;s code is executed, Node.js will wrap it with a function\nwrapper that looks like the following:</p>\n<pre><code class=\"lang-js\">(function(exports, require, module, __filename, __dirname) {\n// Your module code actually lives in here\n});\n</code></pre>\n<p>By doing this, Node.js achieves a few things:</p>\n<ul>\n<li>It keeps top-level variables (defined with <code>var</code>, <code>const</code> or <code>let</code>) scoped to\nthe module rather than the global object.</li>\n<li>It helps to provide some global-looking variables that are actually specific\nto the module, such as:<ul>\n<li>The <code>module</code> and <code>exports</code> objects that the implementor can use to export\nvalues from the module.</li>\n<li>The convenience variables <code>__filename</code> and <code>__dirname</code>, containing the\nmodule&#39;s absolute filename and directory path.</li>\n</ul>\n</li>\n</ul>\n"
        }
      ],
      "vars": [
        {
          "textRaw": "The `module` Object",
          "name": "module",
          "meta": {
            "added": [
              "v0.1.16"
            ]
          },
          "type": "var",
          "desc": "<ul>\n<li>{Object}</li>\n</ul>\n<p>In each module, the <code>module</code> free variable is a reference to the object\nrepresenting the current module.  For convenience, <code>module.exports</code> is\nalso accessible via the <code>exports</code> module-global. <code>module</code> is not actually\na global but rather local to each module.</p>\n",
          "properties": [
            {
              "textRaw": "`children` {Array} ",
              "type": "Array",
              "name": "children",
              "meta": {
                "added": [
                  "v0.1.16"
                ]
              },
              "desc": "<p>The module objects required by this one.</p>\n"
            },
            {
              "textRaw": "`exports` {Object} ",
              "type": "Object",
              "name": "exports",
              "meta": {
                "added": [
                  "v0.1.16"
                ]
              },
              "desc": "<p>The <code>module.exports</code> object is created by the Module system. Sometimes this is\nnot acceptable; many want their module to be an instance of some class. To do\nthis, assign the desired export object to <code>module.exports</code>. Note that assigning\nthe desired object to <code>exports</code> will simply rebind the local <code>exports</code> variable,\nwhich is probably not what you want to do.</p>\n<p>For example suppose we were making a module called <code>a.js</code></p>\n<pre><code class=\"lang-js\">const EventEmitter = require(&#39;events&#39;);\n\nmodule.exports = new EventEmitter();\n\n// Do some work, and after some time emit\n// the &#39;ready&#39; event from the module itself.\nsetTimeout(() =&gt; {\n  module.exports.emit(&#39;ready&#39;);\n}, 1000);\n</code></pre>\n<p>Then in another file we could do</p>\n<pre><code class=\"lang-js\">const a = require(&#39;./a&#39;);\na.on(&#39;ready&#39;, () =&gt; {\n  console.log(&#39;module a is ready&#39;);\n});\n</code></pre>\n<p>Note that assignment to <code>module.exports</code> must be done immediately. It cannot be\ndone in any callbacks.  This does not work:</p>\n<p>x.js:</p>\n<pre><code class=\"lang-js\">setTimeout(() =&gt; {\n  module.exports = { a: &#39;hello&#39; };\n}, 0);\n</code></pre>\n<p>y.js:</p>\n<pre><code class=\"lang-js\">const x = require(&#39;./x&#39;);\nconsole.log(x.a);\n</code></pre>\n",
              "modules": [
                {
                  "textRaw": "exports shortcut",
                  "name": "exports_shortcut",
                  "meta": {
                    "added": [
                      "v0.1.16"
                    ]
                  },
                  "desc": "<p>The <code>exports</code> variable is available within a module&#39;s file-level scope, and is\nassigned the value of <code>module.exports</code> before the module is evaluated.</p>\n<p>It allows a shortcut, so that <code>module.exports.f = ...</code> can be written more\nsuccinctly as <code>exports.f = ...</code>. However, be aware that like any variable, if a\nnew value is assigned to <code>exports</code>, it is no longer bound to <code>module.exports</code>:</p>\n<pre><code class=\"lang-js\">module.exports.hello = true; // Exported from require of module\nexports = { hello: false };  // Not exported, only available in the module\n</code></pre>\n<p>When the <code>module.exports</code> property is being completely replaced by a new\nobject, it is common to also reassign <code>exports</code>, for example:</p>\n<!-- eslint-disable func-name-matching -->\n<pre><code class=\"lang-js\">module.exports = exports = function Constructor() {\n  // ... etc.\n};\n</code></pre>\n<p>To illustrate the behavior, imagine this hypothetical implementation of\n<code>require()</code>, which is quite similar to what is actually done by <code>require()</code>:</p>\n<pre><code class=\"lang-js\">function require(/* ... */) {\n  const module = { exports: {} };\n  ((module, exports) =&gt; {\n    // Your module code here. In this example, define a function.\n    function someFunc() {}\n    exports = someFunc;\n    // At this point, exports is no longer a shortcut to module.exports, and\n    // this module will still export an empty default object.\n    module.exports = someFunc;\n    // At this point, the module will now export someFunc, instead of the\n    // default object.\n  })(module, module.exports);\n  return module.exports;\n}\n</code></pre>\n",
                  "type": "module",
                  "displayName": "exports shortcut"
                }
              ]
            },
            {
              "textRaw": "`filename` {string} ",
              "type": "string",
              "name": "filename",
              "meta": {
                "added": [
                  "v0.1.16"
                ]
              },
              "desc": "<p>The fully resolved filename to the module.</p>\n"
            },
            {
              "textRaw": "`id` {string} ",
              "type": "string",
              "name": "id",
              "meta": {
                "added": [
                  "v0.1.16"
                ]
              },
              "desc": "<p>The identifier for the module.  Typically this is the fully resolved\nfilename.</p>\n"
            },
            {
              "textRaw": "`loaded` {boolean} ",
              "type": "boolean",
              "name": "loaded",
              "meta": {
                "added": [
                  "v0.1.16"
                ]
              },
              "desc": "<p>Whether or not the module is done loading, or is in the process of\nloading.</p>\n"
            },
            {
              "textRaw": "`parent` {Object} Module object ",
              "type": "Object",
              "name": "parent",
              "meta": {
                "added": [
                  "v0.1.16"
                ]
              },
              "desc": "<p>The module that first required this one.</p>\n",
              "shortDesc": "Module object"
            }
          ],
          "methods": [
            {
              "textRaw": "module.require(id)",
              "type": "method",
              "name": "require",
              "meta": {
                "added": [
                  "v0.5.1"
                ]
              },
              "signatures": [
                {
                  "return": {
                    "textRaw": "Returns: {Object} `module.exports` from the resolved module ",
                    "name": "return",
                    "type": "Object",
                    "desc": "`module.exports` from the resolved module"
                  },
                  "params": [
                    {
                      "textRaw": "`id` {string} ",
                      "name": "id",
                      "type": "string"
                    }
                  ]
                },
                {
                  "params": [
                    {
                      "name": "id"
                    }
                  ]
                }
              ],
              "desc": "<p>The <code>module.require</code> method provides a way to load a module as if\n<code>require()</code> was called from the original module.</p>\n<p>Note that in order to do this, you must get a reference to the <code>module</code>\nobject.  Since <code>require()</code> returns the <code>module.exports</code>, and the <code>module</code> is\ntypically <em>only</em> available within a specific module&#39;s code, it must be\nexplicitly exported in order to be used.</p>\n"
            }
          ]
        }
      ],
      "type": "module",
      "displayName": "module"
    }
  ]
}
