cloudux-starter-kit
Version:
Starter kit for UX developers in MediaCentral - NPM package
67 lines • 2.22 kB
JavaScript
function publishOptionsToObject(options) {
const result = {
project: options.project,
config: {
version: options.config.version,
developerID: options.config.developerID,
organization: options.config.organization,
privateKeyPath: options.config.privateKeyPath,
appID: options.config.appID,
appSecret: options.config.appSecret
},
password: options.password,
https_proxy: options.https_proxy,
name: options.name,
build: false,
service: false
};
Object.keys(result).forEach(key => result[key] === undefined ? delete result[key] : '');
Object.keys(result.config).forEach(key => result.config[key] === undefined ? delete result.config[key] : '');
return result;
}
function buildOptionsToObject(options) {
const result = {
project: options.project,
name: options.name,
config: {
version: options.config.version,
developerID: options.config.developerID,
organization: options.config.organization,
appID: options.config.appID,
appSecret: options.config.appSecret
},
password: options.password,
https_proxy: options.https_proxy,
build: true,
service: false
};
Object.keys(result).forEach(key => result[key] === undefined ? delete result[key] : '');
Object.keys(result.config).forEach(key => result.config[key] === undefined ? delete result.config[key] : '');
return result;
}
function buildImageOptionsToObject(options) {
const result = {
project: options.project,
name: options.name,
config: {
version: options.config.version,
developerID: options.config.developerID,
organization: options.config.organization,
appID: options.config.appID,
appSecret: options.config.appSecret
},
password: options.password,
https_proxy: options.https_proxy,
buildImage: true,
build: true,
service: false
};
Object.keys(result).forEach(key => result[key] === undefined ? delete result[key] : '');
Object.keys(result.config).forEach(key => result.config[key] === undefined ? delete result.config[key] : '');
return result;
}
module.exports = {
publishOptionsToObject,
buildOptionsToObject,
buildImageOptionsToObject
};