File size: 256 Bytes
d86b75d
 
 
 
 
1
2
3
4
5
6
const error = new Error();
const callerFile = error.stack?.split('\n')[3].trim().replace(/^at /, '');
const insidePerantheses = callerFile?.match(/\(([^)]+)\)/)?.[1];
const getOnlyfilePaths = insidePerantheses?.split(':')[0]
console.log(getOnlyfilePaths);