Adding missing utils file
This commit is contained in:
parent
1729614a00
commit
0c98a1ab05
3 changed files with 40 additions and 1 deletions
18
dist/core/utils.js
vendored
Normal file
18
dist/core/utils.js
vendored
Normal file
|
@ -0,0 +1,18 @@
|
|||
var Utils = (function () {
|
||||
function Utils() {
|
||||
}
|
||||
Utils.isArgv = function (arg) {
|
||||
return process.argv.indexOf("--" + arg) >= 0 ? true : false;
|
||||
};
|
||||
Utils.merge_options = function (obj1, obj2) {
|
||||
var obj3 = {};
|
||||
for (var attrname in obj1) {
|
||||
obj3[attrname] = obj1[attrname];
|
||||
}
|
||||
for (var attrname in obj2) {
|
||||
obj3[attrname] = obj2[attrname];
|
||||
}
|
||||
return obj3;
|
||||
};
|
||||
return Utils;
|
||||
}());
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"name": "webpack-auto-inject-version",
|
||||
"version": "0.1.0",
|
||||
"version": "0.1.1",
|
||||
"repository": "radswiat/webpack-auto-inject-version",
|
||||
"description": "Webpack plugin for auto inject version from package.json",
|
||||
"main": "dist/main.js",
|
||||
"scripts": {
|
||||
|
|
20
src/core/utils.ts
Normal file
20
src/core/utils.ts
Normal file
|
@ -0,0 +1,20 @@
|
|||
class Utils{
|
||||
|
||||
static isArgv(arg) {
|
||||
return process.argv.indexOf(`--${arg}`) >= 0 ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Overwrites obj1's values with obj2's and adds obj2's if non existent in obj1
|
||||
* @param obj1
|
||||
* @param obj2
|
||||
* @returns obj3 a new object based on obj1 and obj2
|
||||
*/
|
||||
static merge_options(obj1,obj2){
|
||||
var obj3 = {};
|
||||
for (var attrname in obj1) { obj3[attrname] = obj1[attrname]; }
|
||||
for (var attrname in obj2) { obj3[attrname] = obj2[attrname]; }
|
||||
return obj3;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue