getFunctionName.js 188 Bytes Raw Blame History Permalink 1 2 3 4 5 6 7 8 9 10 'use strict'; const functionNameRE = /^function\s*([^\s(]+)/; module.exports = function(fn) { return ( fn.name || (fn.toString().trim().match(functionNameRE) || [])[1] ); };