aboutsummaryrefslogtreecommitdiff
path: root/node_modules/get-caller-file
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2017-05-03 15:35:00 +0200
committerFlorian Dold <florian.dold@gmail.com>2017-05-03 15:35:00 +0200
commitde98e0b232509d5f40c135d540a70e415272ff85 (patch)
treea79222a5b58484ab3b80d18efcaaa7ccc4769b33 /node_modules/get-caller-file
parente0c9d480a73fa629c1e4a47d3e721f1d2d345406 (diff)
node_modules
Diffstat (limited to 'node_modules/get-caller-file')
-rw-r--r--node_modules/get-caller-file/README.md4
-rw-r--r--node_modules/get-caller-file/index.js20
-rw-r--r--node_modules/get-caller-file/package.json31
3 files changed, 55 insertions, 0 deletions
diff --git a/node_modules/get-caller-file/README.md b/node_modules/get-caller-file/README.md
new file mode 100644
index 000000000..c32df54c3
--- /dev/null
+++ b/node_modules/get-caller-file/README.md
@@ -0,0 +1,4 @@
+# get-caller-file
+
+[![Build Status](https://travis-ci.org/ember-cli/ember-cli.svg?branch=master)](https://travis-ci.org/ember-cli/ember-cli)
+[![Build status](https://ci.appveyor.com/api/projects/status/ol2q94g1932cy14a/branch/master?svg=true)](https://ci.appveyor.com/project/embercli/get-caller-file/branch/master)
diff --git a/node_modules/get-caller-file/index.js b/node_modules/get-caller-file/index.js
new file mode 100644
index 000000000..03e7dfc39
--- /dev/null
+++ b/node_modules/get-caller-file/index.js
@@ -0,0 +1,20 @@
+'use strict';
+
+// Call this function in a another function to find out the file from
+// which that function was called from. (Inspects the v8 stack trace)
+//
+// Inspired by http://stackoverflow.com/questions/13227489
+
+module.exports = function getCallerFile(_position) {
+ var oldPrepareStackTrace = Error.prepareStackTrace;
+ Error.prepareStackTrace = function(err, stack) { return stack; };
+ var stack = new Error().stack;
+ Error.prepareStackTrace = oldPrepareStackTrace;
+
+ var position = _position ? _position : 2;
+
+ // stack[0] holds this file
+ // stack[1] holds where this function was called
+ // stack[2] holds the file we're interested in
+ return stack[position] ? stack[position].getFileName() : undefined;
+};
diff --git a/node_modules/get-caller-file/package.json b/node_modules/get-caller-file/package.json
new file mode 100644
index 000000000..4c1b447a5
--- /dev/null
+++ b/node_modules/get-caller-file/package.json
@@ -0,0 +1,31 @@
+{
+ "name": "get-caller-file",
+ "version": "1.0.2",
+ "description": "",
+ "main": "index.js",
+ "directories": {
+ "test": "tests"
+ },
+ "files": [
+ "index.js"
+ ],
+ "scripts": {
+ "test": "mocha test",
+ "test:debug": "mocha test"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/stefanpenner/get-caller-file.git"
+ },
+ "author": "Stefan Penner",
+ "license": "ISC",
+ "bugs": {
+ "url": "https://github.com/stefanpenner/get-caller-file/issues"
+ },
+ "homepage": "https://github.com/stefanpenner/get-caller-file#readme",
+ "devDependencies": {
+ "chai": "^3.4.1",
+ "ensure-posix-path": "^1.0.1",
+ "mocha": "^2.3.4"
+ }
+}