4.1.0 • Published 8 months ago

callsites v4.1.0

Weekly downloads
28,084,392
License
MIT
Repository
github
Last release
8 months ago

callsites

Get callsites from the V8 stack trace API

Install

$ npm install callsites

Usage

import callsites from 'callsites';

function unicorn() {
	console.log(callsites()[0].getFileName());
	//=> '/Users/sindresorhus/dev/callsites/test.js'
}

unicorn();

API

Returns an array of callsite objects with the following methods:

  • getThis: Returns the value of this.
  • getTypeName: Returns the type of this as a string. This is the name of the function stored in the constructor field of this, if available, otherwise the object's [[Class]] internal property.
  • getFunction: Returns the current function.
  • getFunctionName: Returns the name of the current function, typically its name property. If a name property is not available an attempt will be made to try to infer a name from the function's context.
  • getMethodName: Returns the name of the property of this or one of its prototypes that holds the current function.
  • getFileName: If this function was defined in a script returns the name of the script.
  • getLineNumber: If this function was defined in a script returns the current line number.
  • getColumnNumber: If this function was defined in a script returns the current column number
  • getEvalOrigin: If this function was created using a call to eval returns a string representing the location where eval was called.
  • isToplevel: Is this a top-level invocation, that is, is this the global object?
  • isEval: Does this call take place in code defined by a call to eval?
  • isNative: Is this call in native V8 code?
  • isConstructor: Is this a constructor call?

parent-module@jest/source-mapcaller-callsite@huyhpham/rn-linearchetype-library@anio-sh/test-bundlereasy-select-rnvuedragdropuploadimagesreact-native-bluetooth2killi8n-react-native-fast-imagepipihomern-send-smsspecify-importsbabel-specify-imports@oopsunome/latest-gitignore@arisageha/react-lazyload@arisageha/react-lazyload-fix@oneplanetcrowd/developers@cashremit/cr-streamline-icons@almeidaa/msreact-native-template-rfbasecloud-archive-s3airscanairscan-examplebb-chatreact-native-esc-pos-sahaab@borisovart/atol-kkt-module@frxf/frxfdeneme323112@fundefund/funde_ck@ntt_app/react-native-custom-notificationglyph-corereact-native-custom-text-hwjamesreact-native-covid-sdkgql_din_mod@yetan/yetan-clibitgetafryxiconslatest-gitignore-clireact-native-thanh-toast-librarymutasi-bca@jttechnic/interpreter@oopsunome/fast-gitignore@thanhnguyen14797/react-native-thanh-toast-library@eginnovations/eginnovations-capacitor-plugints-gutstokei-js@saeon/quick-formcthpb-plugin-social@iobroker-community-adapters/iobroker.device-watcher@olivervorasai/slidermysql-formatreact-native-printer-brothersrn-pdf-reader-offline@belko.tech/belko-multi-wallet-sdk@nujarum/resolve-esm@newhorizon-tech/dd-npm-package-templatereact-native-shekhar-bridge-testcogoportutilsukor-remasteruncoded-connect@reversodev/oceanic-fleetwilscanner@khalitovadel/abstract-repository@oiti/documentoscopy-react-native@respondea/cordova-plugin-v-inappbrowser@mink-opn/build-tokensquoc-testreact-native-slider-kf@prodam/prodam-types@saaspe/componentsplginexpand-react-bridgeopea-bootstraapluminos-ui-coresklif-ui-kitsklif-apits-handy@everything-registry/sub-chunk-1288jawwy-sdkjawwy_gamification_release@anio-jsbundler/project@anio-jsbundler/runtime@anio-sh/bundler@314oner_npm/universal-components-library@deepakorg/test@deepak757/testreact-native-sphereuisphereuijawwy_libraryeginnovations-capacitor-pluginreact-native-credit-card-pkgp149-table@rabailriaz/hisaab-web-portalsklif-uimachinebeemrcaps@mediakular/svelte-data-gridreact-native-jawwy_samplehayuatuh
4.1.0

8 months ago

4.0.0

3 years ago

3.1.0

5 years ago

3.0.0

5 years ago

2.0.0

8 years ago

1.0.1

8 years ago

1.0.0

10 years ago

0.2.0

10 years ago

0.1.0

10 years ago