{"name":"parent-module","version":"0.1.0","description":"Get the path of the parent module","license":"MIT","repository":{"type":"git","url":"https://github.com/sindresorhus/parent-module"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=0.10.0"},"scripts":{"test":"xo && ava"},"files":["index.js"],"keywords":["parent","module","package","pkg","caller","calling","module","path","callsites","callsite","stacktrace","stack","trace","function","file"],"dependencies":{"callsites":"^1.0.0"},"devDependencies":{"ava":"*","execa":"^0.2.2","xo":"*"},"gitHead":"0ebdd4a7582d4cee30ca2151fbd592b4b3b20ff2","bugs":{"url":"https://github.com/sindresorhus/parent-module/issues"},"homepage":"https://github.com/sindresorhus/parent-module","_id":"parent-module@0.1.0","_shasum":"b5292863a1e8c476ecf857e7d75c98920b24b8a6","_from":".","_npmVersion":"2.14.12","_nodeVersion":"4.2.4","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"b5292863a1e8c476ecf857e7d75c98920b24b8a6","tarball":"http://registry-npm.ywwl.com/parent-module/download/parent-module-0.1.0.tgz","integrity":"sha512-fkZFUUL8tSsJUm/WvAqyJLV/Aj9/jpnMXHy0leJYEUu2qw5FE6nJQI/bMVW2xbZySot4uaPb6cw4eY5zQn7/Ww==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDZY8MMMirTy0zXEW/DWQMPb5mJzvc7SyPcSkiEAaQmLwIhALRon4A7+SwJ5LrpBeD6e96QRtcT2PsQlvWDYP+hnYen"}],"size":2058,"noattachment":false,"key":"/parent-module/-/parent-module-0.1.0.tgz"},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"directories":{},"readme":"# parent-module\n\n> Get the path of the parent module\n\nNode.js exposes `module.parent`, but it only gives you the first cached parent, which is not necessarily the actual parent.\n\n## Install\n\n```sh\nnpm install parent-module\n```\n\n## Usage\n\n```js\n// bar.js\nimport parentModule from 'parent-module';\n\nexport default function bar() {\n\tconsole.log(parentModule());\n\t//=> '/Users/sindresorhus/dev/unicorn/foo.js'\n};\n```\n\n```js\n// foo.js\nimport bar from './bar.js';\n\nbar();\n```\n\n## API\n\n### parentModule(filePath?)\n\nBy default, it will return the path of the immediate parent.\n\n#### filePath\n\nType: `string`\\\nDefault: [`__filename`](https://nodejs.org/api/globals.html#globals_filename)\n\nThe file path of the module of which to get the parent path.\n\nUseful if you want it to work [multiple module levels down](fixtures/filepath).\n\n## Tip\n\nCombine it with [`read-pkg-up`](https://github.com/sindresorhus/read-pkg-up) to read the package.json of the parent module.\n\n```js\nimport path from 'node:path';\nimport {readPackageUpSync} from 'read-pkg-up';\nimport parentModule from 'parent-module';\n\nconsole.log(readPackageUpSync({cwd: path.dirname(parentModule())}).pkg);\n//=> {name: 'chalk', version: '1.0.0', …}\n```\n\n---\n\n<div align=\"center\">\n\t<b>\n\t\t<a href=\"https://tidelift.com/subscription/pkg/npm-parent-module?utm_source=npm-parent-module&utm_medium=referral&utm_campaign=readme\">Get professional support for this package with a Tidelift subscription</a>\n\t</b>\n\t<br>\n\t<sub>\n\t\tTidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.\n\t</sub>\n</div>\n","publish_time":1453475141453,"_cnpm_publish_time":1453475141453,"dist-tags":{"latest":"3.2.0"}}