load-config.js 323 B

1234567891011121314151617181920212223
  1. 'use strict';
  2. /**
  3. * Dependencies
  4. */
  5. const path = require('path');
  6. /**
  7. * Helper to load options from a config file
  8. */
  9. module.exports = function loadConfig(file) {
  10. //No config file provided?
  11. if (!file) {
  12. return {};
  13. }
  14. //Resolve path
  15. file = path.resolve(file);
  16. //Try to load
  17. return require(file);
  18. };