I'm working on a build provider for the Atom text editor, which is a component based on the build package. This package allows you to run some tests to check whether a provider is eligible to run or not, returning true or false respectively.
I'm using glob to check whether a certain file-type is present in the project folder to determine whether to activate the build provider. For example, a project folder should include a LESS file in order to activate a build provider for lessc.
Example:
isEligible() {
    const paths = glob.sync("**/*.less");
    if (paths.length > 0) {
      // one or more LESS files found
      return true;
    }    
    // no LESS files found
    return false;
}
I'm wondering if the same is possible using glob asynchronously, specifically how I can return the state from isEligible(). The following does not work:
isEligible() {
    return glob("**/*.less", function (err, files) {
      if (err) {
        return false;
      }
      return true;
    })
}
 
     
     
    