{"_id":"caller-path","_rev":"1144019","name":"caller-path","description":"Get the path of the caller function","dist-tags":{"latest":"4.0.0"},"maintainers":[{"name":"npm:sindresorhus","email":""}],"time":{"modified":"2021-10-08T06:25:57.000Z","created":"2014-04-19T10:18:32.644Z","4.0.0":"2021-10-08T06:21:34.915Z","3.0.1":"2021-04-18T09:28:19.928Z","3.0.0":"2019-11-22T04:04:20.816Z","2.0.0":"2016-08-28T01:03:04.687Z","1.0.0":"2015-01-24T16:20:15.948Z","0.1.0":"2014-04-19T10:18:32.644Z"},"users":{"stringparser":true,"bojand":true,"andfaulkner":true,"kevin.teljeur":true},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"repository":{"type":"git","url":"git+https://github.com/sindresorhus/caller-path.git"},"versions":{"4.0.0":{"name":"caller-path","version":"4.0.0","description":"Get the path of the caller function","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/caller-path.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":"./index.js","engines":{"node":"^12.20.0 || ^14.13.1 || >=16.0.0"},"scripts":{"test":"xo && ava && tsd"},"keywords":["caller","calling","module","path","parent","callsites","callsite","stacktrace","stack","trace","function","file"],"dependencies":{"caller-callsite":"^5.0.0"},"devDependencies":{"ava":"^3.15.0","tsd":"^0.17.0","typescript":"^4.4.3","xo":"^0.45.0"},"gitHead":"0aced8edafead03ceb68220ef9c08cb509a8d685","bugs":{"url":"https://github.com/sindresorhus/caller-path/issues"},"homepage":"https://github.com/sindresorhus/caller-path#readme","_id":"caller-path@4.0.0","_nodeVersion":"16.10.0","_npmVersion":"7.20.3","dist":{"shasum":"6509f6ba633c9db306bb6de9e86295383aa1e1af","size":2118,"noattachment":false,"key":"/caller-path/-/caller-path-4.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/caller-path/download/caller-path-4.0.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"npm:sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/caller-path_4.0.0_1633674094805_0.3330939522991412"},"_hasShrinkwrap":false,"publish_time":1633674094915,"_cnpm_publish_time":1633674094915},"3.0.1":{"name":"caller-path","version":"3.0.1","description":"Get the path of the caller function","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/caller-path.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=8"},"scripts":{"test":"xo && ava && tsd"},"keywords":["caller","calling","module","path","parent","callsites","callsite","stacktrace","stack","trace","function","file"],"dependencies":{"caller-callsite":"^4.1.0"},"devDependencies":{"ava":"^2.4.0","tsd":"^0.11.0","xo":"^0.25.3"},"gitHead":"5cbd2f1c21586070cf8280f0ceacfbe25798c98b","bugs":{"url":"https://github.com/sindresorhus/caller-path/issues"},"homepage":"https://github.com/sindresorhus/caller-path#readme","_id":"caller-path@3.0.1","_nodeVersion":"12.20.1","_npmVersion":"6.14.10","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"bc932ecec3f943e10c2f8922146e23b132f932e4","size":2207,"noattachment":false,"key":"/caller-path/-/caller-path-3.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/caller-path/download/caller-path-3.0.1.tgz"},"directories":{},"maintainers":[{"name":"npm:sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/caller-path_3.0.1_1618738099793_0.648017930500193"},"_hasShrinkwrap":false,"publish_time":1618738099928,"_cnpm_publish_time":1618738099928},"3.0.0":{"name":"caller-path","version":"3.0.0","description":"Get the path of the caller function","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/caller-path.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=8"},"scripts":{"test":"xo && ava && tsd"},"keywords":["caller","calling","module","path","parent","callsites","callsite","stacktrace","stack","trace","function","file"],"dependencies":{"caller-callsite":"^4.1.0"},"devDependencies":{"ava":"^2.4.0","tsd":"^0.11.0","xo":"^0.25.3"},"gitHead":"b00a61dd2cc8b90430c96bfefa1e259263e1404d","bugs":{"url":"https://github.com/sindresorhus/caller-path/issues"},"homepage":"https://github.com/sindresorhus/caller-path#readme","_id":"caller-path@3.0.0","_nodeVersion":"10.17.0","_npmVersion":"6.11.3","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"a13cbec75eea1b355e3f92dc0df4288b7eebdc5f","size":2241,"noattachment":false,"key":"/caller-path/-/caller-path-3.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/caller-path/download/caller-path-3.0.0.tgz"},"maintainers":[{"name":"npm:sindresorhus","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/caller-path_3.0.0_1574395460691_0.21774906369149094"},"_hasShrinkwrap":false,"publish_time":1574395460816,"_cnpm_publish_time":1574395460816},"2.0.0":{"name":"caller-path","version":"2.0.0","description":"Get the path of the caller function","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/caller-path.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=4"},"scripts":{"test":"xo && ava"},"files":["index.js"],"keywords":["caller","calling","module","path","parent","callsites","callsite","stacktrace","stack","trace","function","file"],"dependencies":{"caller-callsite":"^2.0.0"},"devDependencies":{"ava":"*","xo":"*"},"xo":{"esnext":true},"gitHead":"9fdd6db85d0a82b15ad57fc661d675712b30785a","bugs":{"url":"https://github.com/sindresorhus/caller-path/issues"},"homepage":"https://github.com/sindresorhus/caller-path#readme","_id":"caller-path@2.0.0","_shasum":"468f83044e369ab2010fac5f06ceee15bb2cb1f4","_from":".","_npmVersion":"2.15.9","_nodeVersion":"4.5.0","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"468f83044e369ab2010fac5f06ceee15bb2cb1f4","size":1474,"noattachment":false,"key":"/caller-path/-/caller-path-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/caller-path/download/caller-path-2.0.0.tgz"},"maintainers":[{"name":"npm:sindresorhus","email":""}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/caller-path-2.0.0.tgz_1472346183708_0.9669214419554919"},"directories":{},"publish_time":1472346184687,"_cnpm_publish_time":1472346184687,"_hasShrinkwrap":false},"1.0.0":{"name":"caller-path","version":"1.0.0","description":"Get the path of the caller function","license":"MIT","repository":{"type":"git","url":"https://github.com/sindresorhus/caller-path"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=0.10.0"},"scripts":{"test":"node test.js"},"files":["index.js"],"keywords":["caller","calling","module","path","parent","callsites","callsite","stacktrace","stack","trace","function","file"],"dependencies":{"caller-callsite":"^1.0.0"},"devDependencies":{"ava":"0.0.4"},"gitHead":"f4b4451e4c7bb6d9a3593ae2daea1b8a3c65568d","bugs":{"url":"https://github.com/sindresorhus/caller-path/issues"},"homepage":"https://github.com/sindresorhus/caller-path","_id":"caller-path@1.0.0","_shasum":"881d95105527cad47944c0444232436100056f85","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"maintainers":[{"name":"npm:sindresorhus","email":""}],"dist":{"shasum":"881d95105527cad47944c0444232436100056f85","size":776,"noattachment":false,"key":"/caller-path/-/caller-path-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/caller-path/download/caller-path-1.0.0.tgz"},"directories":{},"publish_time":1422116415948,"_cnpm_publish_time":1422116415948,"_hasShrinkwrap":false},"0.1.0":{"name":"caller-path","version":"0.1.0","description":"Get the path of the caller module","license":"MIT","repository":{"type":"git","url":"git://github.com/sindresorhus/caller-path"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"http://sindresorhus.com"},"engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"files":["index.js"],"keywords":["caller","calling","module","path","parent","callsites","callsite","stacktrace","stack","trace","function","file"],"dependencies":{"callsites":"^0.2.0"},"devDependencies":{"mocha":"*"},"bugs":{"url":"https://github.com/sindresorhus/caller-path/issues"},"homepage":"https://github.com/sindresorhus/caller-path","_id":"caller-path@0.1.0","dist":{"shasum":"94085ef63581ecd3daa92444a8fe94e82577751f","size":879,"noattachment":false,"key":"/caller-path/-/caller-path-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/caller-path/download/caller-path-0.1.0.tgz"},"_from":".","_npmVersion":"1.4.6","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"maintainers":[{"name":"npm:sindresorhus","email":""}],"directories":{},"publish_time":1397902712644,"_cnpm_publish_time":1397902712644,"_hasShrinkwrap":false}},"readme":"# caller-path\n\n> Get the path of the caller function\n\n## Install\n\n```sh\nnpm install caller-path\n```\n\n## Usage\n\n```js\n// foo.js\nimport callerPath from 'caller-path';\n\nexport default function foo() {\n\tconsole.log(callerPath());\n\t//=> '/Users/sindresorhus/dev/unicorn/bar.js'\n}\n```\n\n```js\n// bar.js\nimport foo from './foo.js';\nfoo();\n```\n\nIf the caller's [callsite](https://github.com/sindresorhus/callsites#api) object `getFileName` was not defined for some reason, it will return `undefined`.\n\n## API\n\n### callerPath(options?)\n\nGet the path of the caller function.\n\n##### depth\n\nType: `number`\\\nDefault: `0`\n\nThe caller path depth, meaning how many levels we follow back on the stack trace.\n\nFor example:\n\n```js\n// foo.js\nimport callerPath from 'caller-path';\n\nexport default function foo() {\n\tconsole.log(callerPath());\n\t//=> '/Users/sindresorhus/dev/unicorn/foobar.js'\n\tconsole.log(callerPath({depth: 1}));\n\t//=> '/Users/sindresorhus/dev/unicorn/bar.js'\n\tconsole.log(callerPath({depth: 2}));\n\t//=> '/Users/sindresorhus/dev/unicorn/foo.js'\n}\n```\n\n```js\n// bar.js\nimport foo from './foo.js';\n\nexport default function bar() {\n\tfoo();\n}\n```\n\n```js\n// foobar.js\nimport bar from './bar.js';\nbar();\n```\n\n---\n\n<div align=\"center\">\n\t<b>\n\t\t<a href=\"https://tidelift.com/subscription/pkg/npm-caller-path?utm_source=npm-caller-path&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","_attachments":{},"homepage":"https://github.com/sindresorhus/caller-path#readme","bugs":{"url":"https://github.com/sindresorhus/caller-path/issues"},"license":"MIT"}