diff --git a/index.js b/index.js index 0ce35d5..f4c595e 100644 --- a/index.js +++ b/index.js @@ -10,32 +10,25 @@ let gController = null; alert('assertion failed'); // eslint-disable-line no-alert } }, - keys: theObject => { - const ret = []; - for (const aProperty in theObject) { - if (theObject.hasOwnProperty(aProperty)) { // eslint-disable-line no-prototype-builtins - ret.push(aProperty); - } - } - - return ret; + keys(theObject) { + return Object.keys(theObject); }, createElement(theTag, theProperties, theClassList) { - const ret = document.createElement(theTag); + const returnValue = document.createElement(theTag); if ((typeof undefined !== typeof theProperties) && (theProperties !== null)) { this.keys(theProperties).forEach(theProperty => { - ret[theProperty] = theProperties[theProperty]; + returnValue[theProperty] = theProperties[theProperty]; }); } if ((typeof undefined !== typeof theClassList) && (theClassList !== null)) { theClassList.forEach(theClass => { - ret.classList.add(theClass); + returnValue.classList.add(theClass); }); } - return ret; - } + return returnValue; + }, }; self.buttonDisable = function (theButton) { @@ -49,7 +42,7 @@ let gController = null; }; self.model = { - enabled: true + enabled: true, }; self.show = function () { @@ -60,12 +53,16 @@ let gController = null; aDOMLink.append(aDOMHref); const aAddress = '1ig1p1awfjS5bQxy2s33AD8sVspy4YFMD'; const aDOMBitcoin = self.util.createElement('div', {textContent: aAddress}, ['bitcoin']); - const aDOMQR = self.util.createElement('img', {src: aAddress + '.png', alt: aAddress, width: '200', height: '200'}); + const aDOMQR = self.util.createElement('img', { + src: aAddress + '.png', alt: aAddress, width: '200', height: '200', + }); [aDOMLink, aDOMQR, aDOMBitcoin].forEach(theDOM => { aDOMFooter.append(theDOM); }); - const aDOMInputSatoshiEuro = self.util.createElement('input', {type: 'text', value: '', maxlength: 30, size: 30}, ['input_text']); + const aDOMInputSatoshiEuro = self.util.createElement('input', { + type: 'text', value: '', maxlength: 30, size: 30, + }, ['input_text']); const aDOMWrapResult = self.util.createElement('div', null, ['wrap-result']); const aDOMLabelResult = self.util.createElement('span', {textContent: 'Result:'}); @@ -81,17 +78,17 @@ let gController = null; if (self.model.enabled === true) { self.model.enabled = false; self.buttonDisable(aDOMButtonConvert); - aDOMValueResult.textContent = 100000000 / aDOMInputSatoshiEuro.value; + aDOMValueResult.textContent = 100_000_000 / aDOMInputSatoshiEuro.value; setTimeout(() => { self.buttonEnable(aDOMButtonConvert); self.model.enabled = true; }, 1000); } - } + }, }, ['ig_button', 'normal']); [ - aDOMInputSatoshiEuro, aDOMButtonConvert, aDOMWrapResult, aDOMFooter + aDOMInputSatoshiEuro, aDOMButtonConvert, aDOMWrapResult, aDOMFooter, ].forEach(theDOM => { aDOMContainer.append(theDOM); }); diff --git a/package.json b/package.json index 27fbc79..88e225b 100644 --- a/package.json +++ b/package.json @@ -3,12 +3,16 @@ "test": "xo" }, "devDependencies": { - "xo": "^0.32.1" + "xo": "^0.58.0" }, "xo": { "esnext": true, "space": false, - "rules": {}, + "rules": { + "unicorn/no-array-for-each": 0, + "unicorn/prefer-module": 0, + "unicorn/no-this-assignment": 0 + }, "semicolon": true, "envs": [ "browser", diff --git a/pm2-serve.sh b/pm2-serve.sh new file mode 100644 index 0000000..1596c09 --- /dev/null +++ b/pm2-serve.sh @@ -0,0 +1 @@ +pm2 serve . 8081 --name satoshieuro-eurobitcoin_converter-8081