aboutsummaryrefslogtreecommitdiff
path: root/node_modules/cosmiconfig/lib/loadJs.js
blob: c08d524964407cb781c8b4b10889d935253d9e9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
'use strict';

var requireFromString = require('require-from-string');
var readFile = require('./readFile');

module.exports = function (filepath) {
  return readFile(filepath).then(function (content) {
    if (!content) return null;

    return {
      config: requireFromString(content, filepath),
      filepath: filepath,
    };
  });
};