3 Star 4 Fork 4

ToolGood/ToolGood.Algorithm

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
BaseUnitConverter.js 642 Bytes
一键复制 编辑 原始数据 按行查看 历史
ToolGood 提交于 2026-02-01 19:48 +08:00 . fix
import { UnitFactors } from './UnitFactors.js';
class BaseUnitConverter {
// Set Unit conversions and initial Left/Right conversion
Instantiate(conversionFactors, leftUnit, rightUnit) {
this.units = conversionFactors;
this.unitLeft = leftUnit;
this.unitRight = rightUnit;
}
// Convert the Unit on the Left to the Unit on the Right
LeftToRight(value) {
let startFactor = this.units.FindFactor(this.unitLeft);
let endFactor = this.units.FindFactor(this.unitRight);
let result = (value / startFactor) * endFactor;
return result;
}
}
export { BaseUnitConverter };
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C#
1
https://gitee.com/toolgood/ToolGood.Algorithm.git
git@gitee.com:toolgood/ToolGood.Algorithm.git
toolgood
ToolGood.Algorithm
ToolGood.Algorithm
master

搜索帮助