{"name":"caller-callsite","version":"5.0.0","description":"Get the callsite of the caller function","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/caller-callsite.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","parent","callsites","callsite","stacktrace","stack","trace","function","file"],"dependencies":{"callsites":"^4.0.0"},"devDependencies":{"ava":"^3.15.0","tsd":"^0.17.0","typescript":"^4.4.3","xo":"^0.45.0"},"gitHead":"3a90a027845c262255117615ad8274dd56ca85d9","bugs":{"url":"https://github.com/sindresorhus/caller-callsite/issues"},"homepage":"https://github.com/sindresorhus/caller-callsite#readme","_id":"caller-callsite@5.0.0","_nodeVersion":"16.10.0","_npmVersion":"7.20.3","dist":{"integrity":"sha512-l3+xZHsuNlFjchy1nl1kpQwi7PhKHgtQ7MOx5ijHwlouAjnwRNjq3AlxH8SGuWiF5XAhb/mSH+c90LIDFjJKtA==","shasum":"e95f38263a0aa0c74ed339bc417ef5281647bdd5","tarball":"http://registry-npm.ywwl.com/caller-callsite/download/caller-callsite-5.0.0.tgz","fileCount":5,"unpackedSize":5385,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh2lbUCRA9TVsSAnZWagAAb5cP/20YIjqz6Lo39D93KOO6\nzhMH/0+5k+s+77abTd93ou3D9KuP4pjL8phGJwipEvl8IdVGGlCRyYm7koj5\ndzqeXyrw7XXdcrP3Ag189eH8V43DyXWewEcNXzFZBzy7hS9GYSOSi5UD+VSu\nl412kjsgCZcaNXvs5K6Lo807mV8l3nj7SN3+whmklOLdYmYlMJTZPAcseVcY\nmVmMvTlWDhqS6Vz/oSgKEgHuDAeA9pacfa1q/yMe2V+XOZJg5q8uVP6RKREr\n1zQcbDD9A4tpaodc844RpxWbTCKmGdRU40Rev0EmPz8JvQ0sdqvYBrKMLq1v\nTE+x9hMiazMVd4ktk6fUyg367CH46FM4abu3Uw5cJiCOQPSu1P8FWa06RELB\nj8h5lAg1Tn1GrSy2LBk9ZCgB3L4ztlG6aEtE1rJaRiXEAH+z9/+VsJDVXKoU\nKfoJhAGnVuPdxPGXO/RCJJKK+XcFm+Pz73Zatylm+L7BfubjdtzbkDgNbeeZ\nfqRQ4A3RiBA+YfXpAXF2ZJbIFai66ira7jwoQh82CIOZwF4A5b1PRzJfG7Ub\naZ65OIqPSrv91bvujFBMV7tsx2jIFU6pZ7S+UVsZJqiCZsCHHXv7/By0itqq\nPm1zuBFMY8Cu19TdsCgVs34EVxbDHcUGH/TfLXm3V7RDmkjMtaIl+/dh6dby\n4SU7\r\n=DgBR\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDtrNu/fudGaWoLfE19zGjiyX2m8UP71A34BfIH8irb4wIhAKUwT+ydZJqo4gb/YZ4yINs/fYQFiTsFaRhz0WBIbWGt"}],"size":2202,"noattachment":false,"key":"/caller-callsite/-/caller-callsite-5.0.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/caller-callsite_5.0.0_1633616876452_0.20073596412272088"},"_hasShrinkwrap":false,"readme":"# caller-callsite\n\n> Get the [callsite](https://github.com/sindresorhus/callsites#api) of the caller function\n\n## Install\n\n```sh\nnpm install caller-callsite\n```\n\n## Usage\n\n```js\n// foo.js\nimport callerCallsite from 'caller-callsite';\n\nexport default function foo() {\n\tconsole.log(callerCallsite().getFileName());\n\t//=> '/Users/sindresorhus/dev/unicorn/bar.js'\n}\n```\n\n```js\n// bar.js\nimport foo from './foo.js';\nfoo();\n```\n\n## API\n\n### callerCallsite(options?)\n\nReturns a [`callsite`](https://github.com/sindresorhus/callsites#api) object.\n\n#### options\n\nType: `object`\n\n##### depth\n\nType: `number`\\\nDefault: `0`\n\nThe callsite depth, meaning how many levels we follow back on the stack trace.\n\nFor example:\n\n```js\n// foo.js\nimport callerCallsite from 'caller-callsite';\n\nexport default function foo() {\n\tconsole.log(callerCallsite().getFileName());\n\t//=> '/Users/sindresorhus/dev/unicorn/foobar.js'\n\tconsole.log(callerCallsite({depth: 1}).getFileName());\n\t//=> '/Users/sindresorhus/dev/unicorn/bar.js'\n\tconsole.log(callerCallsite({depth: 2}).getFileName());\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 foo() {\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-callsite?utm_source=npm-caller-callsite&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":1633616876631,"_cnpm_publish_time":1633616876631,"dist-tags":{"latest":"6.0.0"}}