Philipp Dieter 06db35fd97 Init
2024-06-23 19:44:28 +02:00

30 lines
654 B
JavaScript

module.exports = {
ifProduction: function(env, option1, option2) {
if (env.production) {
return option1;
}
return option2;
},
ifNotProduction: function(env, option1, option2) {
if (env.production) {
return option2;
}
return option1;
},
removeEmpty: function(input) {
let output
if (Array.isArray(input)) {
output = input.filter(item => typeof item !== 'undefined')
} else {
output = {}
Object.keys(input).forEach(key => {
const value = input[key]
if (typeof value !== 'undefined') {
output[key] = value
}
})
}
return output
}
}