All files require-search.js

0% Statements 0/5
0% Branches 0/5
0% Functions 0/2
0% Lines 0/4
1 2 3 4 5 6 7 8 9 10 11 12 13 14                           
import path from 'path';
 
export default (relativeTo, paths) => {
  let result;
  for (const testPath of paths.concat(paths.map(mapPath => path.resolve(relativeTo, mapPath)))) {
    try {
      result = require(testPath);
      return typeof result === 'object' && result && result.default ? result.default : result;
    } catch (err) {
      // Ignore the error
    }
  }
};