aboutsummaryrefslogtreecommitdiff
path: root/node_modules/fn-name/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/fn-name/index.js')
-rw-r--r--node_modules/fn-name/index.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/node_modules/fn-name/index.js b/node_modules/fn-name/index.js
new file mode 100644
index 000000000..c8933518a
--- /dev/null
+++ b/node_modules/fn-name/index.js
@@ -0,0 +1,8 @@
+'use strict';
+module.exports = function (fn) {
+ if (typeof fn !== 'function') {
+ throw new TypeError('Expected a function');
+ }
+
+ return fn.displayName || fn.name || (/function ([^\(]+)?\(/.exec(fn.toString()) || [])[1] || null;
+};