Init
This commit is contained in:
commit
a80bd097dd
29
index.js
Normal file
29
index.js
Normal 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
11
package.json
Normal 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"
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user