diff --git a/dist/core/utils.js b/dist/core/utils.js new file mode 100644 index 0000000..cc2f09a --- /dev/null +++ b/dist/core/utils.js @@ -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; +}()); diff --git a/package.json b/package.json index 408efb5..701b5f6 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/src/core/utils.ts b/src/core/utils.ts new file mode 100644 index 0000000..edd7a88 --- /dev/null +++ b/src/core/utils.ts @@ -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; + } + +} \ No newline at end of file