aboutsummaryrefslogtreecommitdiff
path: root/node_modules/fn-name/index.js
blob: c8933518a9fa1419df2e56c282c091a4f54cc9f1 (plain)
1
2
3
4
5
6
7
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;
};