callsites
Advanced tools
Comparing version 2.0.0 to 3.0.0
10
index.js
'use strict'; | ||
module.exports = () => { | ||
const _ = Error.prepareStackTrace; | ||
const callsites = () => { | ||
const _prepareStackTrace = Error.prepareStackTrace; | ||
Error.prepareStackTrace = (_, stack) => stack; | ||
const stack = new Error().stack.slice(1); | ||
Error.prepareStackTrace = _; | ||
Error.prepareStackTrace = _prepareStackTrace; | ||
return stack; | ||
}; | ||
module.exports = callsites; | ||
module.exports.default = callsites; |
{ | ||
"name": "callsites", | ||
"version": "2.0.0", | ||
"description": "Get callsites from the V8 stack trace API", | ||
"license": "MIT", | ||
"repository": "sindresorhus/callsites", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
}, | ||
"engines": { | ||
"node": ">=4" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"keywords": [ | ||
"stacktrace", | ||
"v8", | ||
"callsite", | ||
"callsites", | ||
"stack", | ||
"trace", | ||
"function", | ||
"file", | ||
"line", | ||
"debug" | ||
], | ||
"devDependencies": { | ||
"ava": "*", | ||
"xo": "*" | ||
}, | ||
"xo": { | ||
"esnext": true | ||
} | ||
"name": "callsites", | ||
"version": "3.0.0", | ||
"description": "Get callsites from the V8 stack trace API", | ||
"license": "MIT", | ||
"repository": "sindresorhus/callsites", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
}, | ||
"engines": { | ||
"node": ">=6" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava && tsd-check" | ||
}, | ||
"files": [ | ||
"index.js", | ||
"index.d.ts" | ||
], | ||
"keywords": [ | ||
"stacktrace", | ||
"v8", | ||
"callsite", | ||
"callsites", | ||
"stack", | ||
"trace", | ||
"function", | ||
"file", | ||
"line", | ||
"debug" | ||
], | ||
"devDependencies": { | ||
"ava": "^0.25.0", | ||
"tsd-check": "^0.2.1", | ||
"xo": "^0.23.0" | ||
} | ||
} |
# callsites [![Build Status](https://travis-ci.org/sindresorhus/callsites.svg?branch=master)](https://travis-ci.org/sindresorhus/callsites) | ||
> Get callsites from the [V8 stack trace API](https://github.com/v8/v8/wiki/Stack-Trace-API) | ||
> Get callsites from the [V8 stack trace API](https://v8.dev/docs/stack-trace-api) | ||
@@ -9,3 +9,3 @@ | ||
``` | ||
$ npm install --save callsites | ||
$ npm install callsites | ||
``` | ||
@@ -32,11 +32,13 @@ | ||
- `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. | ||
- `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 | ||
- `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 CallSite object representing the location where eval was called | ||
- `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? | ||
- `isEval`: does this call take place in code defined by a call to `eval`? | ||
- `isNative`: is this call in native V8 code? | ||
@@ -43,0 +45,0 @@ - `isConstructor`: is this a constructor call? |
Sorry, the diff of this file is not supported yet
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
5855
5
70
49
0
3