This commit is contained in:
Philipp Dieter 2024-06-23 19:46:46 +02:00
commit a80bd097dd
2 changed files with 40 additions and 0 deletions

29
index.js Normal file
View File

@ -0,0 +1,29 @@
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
}
}

11
package.json Normal file
View File

@ -0,0 +1,11 @@
{
"name": "webpack-config-helpers",
"version": "0.0.1",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "AGPL-3.0-or-later"
}