1 |
|
2 |
|
3 | const fpStackTracePattern = /at\s{1}(?:.*\.)?plugin\s{1}.*\n\s*(.*)/
|
4 | const fileNamePattern = /(\w*(\.\w*)*)\..*/
|
5 |
|
6 | module.exports = function extractPluginName (stack) {
|
7 | const m = stack.match(fpStackTracePattern)
|
8 |
|
9 | // get last section of path and match for filename
|
10 | return m ? m[1].split(/[/\\]/).slice(-1)[0].match(fileNamePattern)[1] : 'anonymous'
|
11 | }
|