stefanpenner / get-caller-file

ISC License
37 stars 11 forks source link

returns null with async functions #19

Open cfurst opened 5 years ago

cfurst commented 5 years ago
const getCallerFile = require('get-caller-file');

const numArray = [1,2,3,4,5];
if (numArray.some(num => {
    const file = getCallerFile();
    console.log(`we are in ${file}`);
    return true;
})) {
  console.log("see above ^^ shouldn't be null");
}

output:

we are in null
see above ^^ shouldn't be null