(paths, getDefault)
| 12 | } |
| 13 | |
| 14 | function requireFirst(paths, getDefault) { |
| 15 | if (typeof getDefault === 'undefined') { |
| 16 | getDefault = function() { return null; }; |
| 17 | } |
| 18 | if (paths.length === 0) { |
| 19 | return getDefault(); |
| 20 | } |
| 21 | |
| 22 | // Try to resolve all alternatives except the last one |
| 23 | var path, i; |
| 24 | for (i = 0; i < paths.length; i++) { |
| 25 | path = paths[i]; |
| 26 | if (moduleExists(path)) { |
| 27 | return require(path); |
| 28 | } |
| 29 | } |
| 30 | return getDefault(); |
| 31 | } |
| 32 | |
| 33 | module.exports = function(opts) { |
| 34 | var config; |
no test coverage detected