UNPKG

343 BJavaScriptView Raw
1const fs = require('fs');
2const path = require('path');
3
4/**
5 * @param {string} formatterPath
6 * @returns {string}
7 */
8module.exports = function resolveCustomFormatter(formatterPath) {
9 const resolvedPath = path.resolve(formatterPath);
10
11 if (fs.existsSync(resolvedPath)) {
12 return resolvedPath;
13 }
14
15 return require.resolve(formatterPath);
16};