Skip to content
Snippets Groups Projects
Commit 24c324c5 authored by Steven Hargrove's avatar Steven Hargrove Committed by Rhys Arkins
Browse files

refactor: initPlatform

parent 7b0ae535
No related branches found
No related tags found
No related merge requests found
const github = require('./github');
const gitlab = require('./gitlab');
const vsts = require('./vsts');
/* eslint-disable global-require */
const platforms = new Map([
['github', require('./github')],
['gitlab', require('./gitlab')],
['vsts', require('./vsts')],
]);
/* eslint-enable global-require */
function initPlatform(val) {
if (val === 'github') {
global.platform = github;
} else if (val === 'gitlab') {
global.platform = gitlab;
} else if (val === 'vsts') {
global.platform = vsts;
function getPlatformApi(platform) {
return platforms.get(platform);
}
function initPlatform(platform) {
global.platform = getPlatformApi(platform);
}
module.exports = {
initPlatform,
getPlatformApi,
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment