dotfiles/.vscode/extensions/saviorisdead.RustyCode-0.18.0/node_modules/rechoir/lib/register.js
Cyryl Płotnicki 2f946d6200 Add .vscode
2016-09-11 10:29:13 +02:00

15 lines
360 B
JavaScript

const path = require('path');
const resolve = require('resolve');
module.exports = function (cwd, moduleName, register) {
try {
var modulePath = resolve.sync(moduleName, {basedir: cwd});
var result = require(modulePath);
if (typeof register === 'function') {
register(result);
}
} catch (e) {
result = e;
}
return result;
};