2.0.5 • Published 5 years ago

get-caller-file v2.0.5

Weekly downloads
24,593,801
License
ISC
Repository
github
Last release
5 years ago

get-caller-file

Build Status Build status

This is a utility, which allows a function to figure out from which file it was invoked. It does so by inspecting v8's stack trace at the time it is invoked.

Inspired by http://stackoverflow.com/questions/13227489

note: this relies on Node/V8 specific APIs, as such other runtimes may not work

Installation

yarn add get-caller-file

Usage

Given:

// ./foo.js
const getCallerFile = require('get-caller-file');

module.exports = function() {
  return getCallerFile(); // figures out who called it
};
// index.js
const foo = require('./foo');

foo() // => /full/path/to/this/file/index.js

Options:

  • getCallerFile(position = 2): where position is stack frame whos fileName we want.
yargsarchetype-libraryeasy-select-rnvuedragdropuploadimagesvirtuellesburgerburoreact-native-bluetooth2killi8n-react-native-fast-imagern-send-smsspecify-importsbabel-specify-imports@icanpm/api-masterfoshata-markdown@cashremit/cr-streamline-iconsreact-native-template-rfbaseairscanairscan-examplebb-chatreact-native-esc-pos-sahaab@borisovart/atol-kkt-module@frxf/frxfbackend-storiesdeneme323112@texttree/demo-bsa-reference-rcl@ntt_app/react-native-custom-notificationreact-native-custom-text-hwjames@sonammalhotra/lotideregenie@smishra17/lotide@cheapthrills/lotidereact-native-covid-sdkgql_din_modbitgetcustom-angular-clireact-native-thanh-toast-librarysalut_gongjang_first_module@jttechnic/interpreter@thanhnguyen14797/react-native-thanh-toast-library@l1nyanm1ng/react-picture-viewercthpb-plugin-social@iobroker-community-adapters/iobroker.device-watcher@olivervorasai/sliderreact-native-printer-brothersrn-pdf-reader-offline@newhorizon-tech/dd-npm-package-templatereact-native-shekhar-bridge-testcogoportutilslevibestliblevibestlib2levilibtest19levilibtest24levilibtest25levilibtest26levilibtest27levilibtest28levilibtest29levinodelib@nicholasjj/lotidewilscanner@oiti/documentoscopy-react-native@mink-opn/build-tokensquoc-testreact-native-slider-kfnodejs-fileshareunblock-block-save-variables@infinitebrahmanuniverse/nolb-get-c@prodam/prodam-typescclibyarntest@saaspe/componentsplginexpand-react-bridgeopea-bootstraapluminos-ui-coresklif-ui-kitsklif-api@everything-registry/sub-chunk-1750jawwy-sdkjawwy_gamification_release@314oner_npm/universal-components-libraryreact-native-sphereuisphereuijawwy_libraryreact-native-credit-card-pkgp149-table@rabailriaz/hisaab-web-portalsklif-uireact-native-jawwy_sampleorganization-robotics-sensors-website-application-electronorganization-algorithm-model-research-website-application-electronorganization-application-ui-ux-website-application-electronorganization-artificial-intelligence-computer-vision-website-application-electronoracle-zkappowt-client-javascriptoutils-renp147-tablep148-tablenka-gantt-task-reactnove-repositorynotion-database-exporternpm_qwertynpm-package-mentorcheck
2.0.5

5 years ago

2.0.4

5 years ago

2.0.3

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

6 years ago

1.0.3

6 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago