{"name":"parent-module","version":"2.0.0","description":"Get the path of the parent module","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/parent-module.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=8"},"scripts":{"test":"xo && ava && tsd"},"keywords":["parent","module","package","caller","calling","module","path","callsites","callsite","stacktrace","stack","trace","function","file"],"dependencies":{"callsites":"^3.1.0"},"devDependencies":{"ava":"^1.4.1","execa":"^1.0.0","tsd":"^0.7.2","xo":"^0.24.0"},"gitHead":"1923bf8f724f7f2e77a2c893116285a8b0a47598","bugs":{"url":"https://github.com/sindresorhus/parent-module/issues"},"homepage":"https://github.com/sindresorhus/parent-module#readme","_id":"parent-module@2.0.0","_nodeVersion":"8.16.0","_npmVersion":"6.9.0","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"integrity":"sha512-uo0Z9JJeWzv8BG+tRcapBKNJ0dro9cLyczGzulS6EfeyAdeC9sbojtW6XwvYxJkEne9En+J2XEl4zyglVeIwFg==","shasum":"fa71f88ff1a50c27e15d8ff74e0e3a9523bf8708","tarball":"http://registry-npm.ywwl.com/parent-module/download/parent-module-2.0.0.tgz","fileCount":5,"unpackedSize":4625,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcyFjVCRA9TVsSAnZWagAA/yQP/3p0SAYda/UfvdMK1J3A\necG8eD/cd8XMG9f7mcyvdOkd2YM3IPfu0capE6kP4Wp9TkZPnpMTxguu2oxe\ni+mssu1Dd/L8LMxxsbsU7V3EyX2QV0dGsiB91H/QlPRfr3WapnL660JTNaze\n0cQF9vOs8GfTUCrsm3IOxuPJHiAkxs4udS1NzgNsGh5custjt9tP5Dx8fu8j\nCFDzT6R38iEV2Cn2w0IIQzJBkhQ5XuKgiex8RMtvKRa+fWSSwkQlMRM+9QRE\n5x1ACxEbFiubXr0pG3eZt6gMR8cCoxZjqOfXOAS6c5BGunVDLDY7UpJnhQEH\nfgJqbpzTsXYtaoDN9O4U1UloGyiLYKu8bTigBBfsPc5d/L0vUtWK4kw6XX6F\nHZuqQibUlTcXWc17zKyb+QOtTcIs2LAOhd0YB+vNxf45whQyO+bwl+N3LAd1\nJz5qh/kUw4/0YtQZuTrqbl58F2/hk/zGPpS8rbF4Nk25pi+sdzuqMpGuXMhF\ngTMTg1SmgVX4O29hKtLqiTE8+1T/mQR25mm7MfNmM0go1nHUmEe6tzA71Qb1\nvBnVimAkAxXTKdd8p5KchKNpYo+hJ+OKPpdt8LEwZlGm9Qs+5+INtDwHUTts\nZP3FvhmRX3oDhAavOEBM7wtX6oQR8IROq32aKPJ8jn6KdrixER/htTKDqQLM\nyLn+\r\n=G19r\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICmQCYnaIZ1l00dvvfSVtxPE9vaATS8BsGo3Lhav91Q7AiEA6uiYRdPyzE4+fo8zrPAUfML7VHHqUaqvxDzcyFYW2Ck="}],"size":2179,"noattachment":false,"key":"/parent-module/-/parent-module-2.0.0.tgz"},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/parent-module_2.0.0_1556633813147_0.3310203047620397"},"_hasShrinkwrap":false,"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":1556633813267,"_cnpm_publish_time":1556633813267,"dist-tags":{"latest":"3.2.0"}}