{"name":"parent-module","version":"1.0.1","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":">=6"},"scripts":{"test":"xo && ava"},"keywords":["parent","module","package","pkg","caller","calling","module","path","callsites","callsite","stacktrace","stack","trace","function","file"],"dependencies":{"callsites":"^3.0.0"},"devDependencies":{"ava":"^1.4.1","execa":"^1.0.0","xo":"^0.24.0"},"gitHead":"48267d001c4d215ba21a701a6882dba30fb8d614","bugs":{"url":"https://github.com/sindresorhus/parent-module/issues"},"homepage":"https://github.com/sindresorhus/parent-module#readme","_id":"parent-module@1.0.1","_nodeVersion":"8.15.0","_npmVersion":"6.9.0","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"integrity":"sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==","shasum":"691d2709e78c79fae3a156622452d00762caaaa2","tarball":"http://registry-npm.ywwl.com/parent-module/download/parent-module-1.0.1.tgz","fileCount":4,"unpackedSize":3922,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcnLEgCRA9TVsSAnZWagAAnfUP/34CM4qiVo4Qaylc5j9N\naflPKZecVGFTivIGy9F7I+dTMiCXRhABp0MaLq1s03KOHAgym2ZL89ItB+l9\ngeUhRz7hFcTm4sP+iEtBQ0D+vr0Q+arS7qoROTXJ94ybC0rC/+Hr9XyvXZRX\nW0KQYkekqyTn5AIH1ZN7o0zgnfapdTgz7zBhGTsICqd1jl3FFJLshsXowO1X\naBCErOvowwQKaTVWnU65cIuMKKN9g80jIWZVYu5F6B9VOUOV7moGY3C0GofN\nD/b2lSMlF8En4UbiSI1F0NmGwnbDplri5KsHyXAFSoVhQFp65VQBJjZU/DnM\n8S8zan/8jpAAxAw7cZZ0G911zDLh+Jo7HuB+xc+dwLbK8fONAJOVFkRLAdCJ\nGC/XcyZ5ftPTwmDbn3wLOdk8UZytBP/FD69NU4HTvPkG2SkKAbv0jK+nIJEs\ncaQGh42m7mFEhmiXBLJZ83UAFlVsyAej9s14GRet3fAqWhIbnzdv9boQwYSi\nTGy0kxGtaaa8G/WcBZyn+hGGPlakNn0RUV6ZhZ0y5zpaM/YPFS885Oj0i8Um\nhuwvIYCf6hlxcLylUI/BY+HLzp2W7qFABT+ib7VA3QHznyW21tyHqXGXWiiu\n9urgGmksS5dhsEF4vYzZPN80xAI4qXf5pIBMUzB0b1kvemyCGJ/9FCxUghlt\nqqUz\r\n=Y7oh\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIH0o9dG06lHpdesOZRHLalVMES4OwKx40Db5qlXGMeI2AiEAuT6JtVLbiHQhF0YM+0LOWNmKt3pqYZmksmHz8J1NZhU="}],"size":2008,"noattachment":false,"key":"/parent-module/-/parent-module-1.0.1.tgz"},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/parent-module_1.0.1_1553772832186_0.1578223180001468"},"_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":1553772832331,"_cnpm_publish_time":1553772832331,"dist-tags":{"latest":"3.2.0"}}