You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
405 B
22 lines
405 B
package et_calc
|
|
|
|
import "strings"
|
|
|
|
func unitTrans(data map[string]float64, inUnits, outUnits map[string]string) {
|
|
for kName, _ := range data {
|
|
inUnit, ok := inUnits[kName]
|
|
outUnit, ok2 := outUnits[kName]
|
|
if strings.EqualFold(inUnit, outUnit) || !ok || !ok2 {
|
|
continue
|
|
} else {
|
|
data[kName] *= getCoef(inUnit, outUnit)
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
func getCoef(in, out string) float64 {
|
|
k := 1.0
|
|
|
|
return k
|
|
}
|
|
|