Comparing version 1.0.0 to 1.0.1
'use strict'; | ||
module.exports = function () { | ||
var _ = Error.prepareStackTrace; | ||
Error.prepareStackTrace = function (_, stack) { return stack }; | ||
Error.prepareStackTrace = function (_, stack) { | ||
return stack; | ||
}; | ||
var stack = new Error().stack.slice(1); | ||
@@ -6,0 +8,0 @@ Error.prepareStackTrace = _; |
{ | ||
"name": "callsites", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Get callsites from the V8 stack trace API", | ||
@@ -10,9 +10,9 @@ "license": "MIT", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "http://sindresorhus.com" | ||
"url": "sindresorhus.com" | ||
}, | ||
"engines": { | ||
"node": ">=0.10.0" | ||
"node": ">=0.10" | ||
}, | ||
"scripts": { | ||
"test": "mocha" | ||
"test": "xo && ava" | ||
}, | ||
@@ -23,6 +23,6 @@ "files": [ | ||
"keywords": [ | ||
"stacktrace", | ||
"v8", | ||
"callsite", | ||
"callsites", | ||
"callsite", | ||
"v8", | ||
"stacktrace", | ||
"stack", | ||
@@ -36,4 +36,5 @@ "trace", | ||
"devDependencies": { | ||
"mocha": "*" | ||
"ava": "*", | ||
"xo": "*" | ||
} | ||
} |
# 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://code.google.com/p/v8/wiki/JavaScriptStackTraceApi) | ||
> Get callsites from the [V8 stack trace API](https://github.com/v8/v8/wiki/Stack-Trace-API) | ||
@@ -8,3 +8,3 @@ | ||
```sh | ||
``` | ||
$ npm install --save callsites | ||
@@ -17,7 +17,7 @@ ``` | ||
```js | ||
var callsites = require('callsites'); | ||
const callsites = require('callsites'); | ||
function unicorn() { | ||
console.log(callsites()[0].getFileName()); | ||
//=> /Users/sindresorhus/dev/callsites/test.js | ||
//=> '/Users/sindresorhus/dev/callsites/test.js' | ||
} | ||
@@ -28,2 +28,3 @@ | ||
## API | ||
@@ -33,5 +34,3 @@ | ||
- `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. | ||
@@ -43,3 +42,3 @@ - `getMethodName`: returns the name of the property of this or one of its prototypes that holds the current function | ||
- `getEvalOrigin`: if this function was created using a call to eval returns a CallSite object representing the location where eval was called | ||
- `isToplevel`: is this a toplevel invocation, that is, is this the global object? | ||
- `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? | ||
@@ -52,2 +51,2 @@ - `isNative`: is this call in native V8 code? | ||
MIT © [Sindre Sorhus](http://sindresorhus.com) | ||
MIT © [Sindre Sorhus](https://sindresorhus.com) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
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
3785
4
10
2
47