Buckets:
| const fpStackTracePattern = /at\s(?:.*\.)?plugin\s.*\n\s*(.*)/ | |
| const fileNamePattern = /(\w*(\.\w*)*)\..*/ | |
| module.exports = function getPluginName (fn) { | |
| if (fn.name.length > 0) return fn.name | |
| const stackTraceLimit = Error.stackTraceLimit | |
| Error.stackTraceLimit = 10 | |
| try { | |
| throw new Error('anonymous function') | |
| } catch (e) { | |
| Error.stackTraceLimit = stackTraceLimit | |
| return extractPluginName(e.stack) | |
| } | |
| } | |
| function extractPluginName (stack) { | |
| const m = stack.match(fpStackTracePattern) | |
| // get last section of path and match for filename | |
| return m ? m[1].split(/[/\\]/).slice(-1)[0].match(fileNamePattern)[1] : 'anonymous' | |
| } | |
| module.exports.extractPluginName = extractPluginName | |
Xet Storage Details
- Size:
- 720 Bytes
- Xet hash:
- 4ce63a982bcbd6dfbdcdb8ceae7b74f86d5e02cbfdb9f94574e1fc7008727782
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.