refactor multiple if else into a single condition

pull/1/head
Iuri Matias 6 years ago committed by yann300
parent 749ad2038a
commit 77d366c1b9
  1. 10
      src/app/tabs/run-tab.js

@ -32,14 +32,8 @@ function runTab (opts, localRegistry) {
var index = select.selectedIndex
var selectedUnit = select.querySelectorAll('option')[index].dataset.unit
var unit = 'ether' // default
if (selectedUnit === 'ether') {
unit = 'ether'
} else if (selectedUnit === 'finney') {
unit = 'finney'
} else if (selectedUnit === 'gwei') {
unit = 'gwei'
} else if (selectedUnit === 'wei') {
unit = 'wei'
if (['ether', 'finney', 'gwei', 'wei'].indexOf(selectedUnit) >= 0) {
unit = selectedUnit
}
cb(null, executionContext.web3().toWei(number, unit))
} catch (e) {

Loading…
Cancel
Save