@44north/unitconverter 中文文档教程
UnitConverter
该模块旨在提供用于测试模块和服务的辅助方法。
Install
登录到 npm
并运行以下其中一项
npm install @44north/unitconverter --save-dev
或
yarn add @44north/unitconverter --dev
Usage
import { TemperatureConverter } from "@44north/unitconverter";
const temp1 = new TemperatureConverter("F", "C").convert(212); // 100
const temp2 = new TemperatureConverter()
.setFromUnit("F")
.setToUnit("C")
.convert(212); // 100
const temp3 = new TemperatureConverter().convert(212, "F", "C"); // 100
const temp4 = TemperatureConverter.convert(212)
.from("F")
.to("C"); // 100
Attribution
此模块基于 Ben Ng 存储库 convert-units npm 模块。 虽然功能正常,但几年没有维护或更新。
UnitConverter
This module is ment to provide helper methods for testing modules and services.
Install
Log into npm
and run one of the following
npm install @44north/unitconverter --save-dev
or
yarn add @44north/unitconverter --dev
Usage
import { TemperatureConverter } from "@44north/unitconverter";
const temp1 = new TemperatureConverter("F", "C").convert(212); // 100
const temp2 = new TemperatureConverter()
.setFromUnit("F")
.setToUnit("C")
.convert(212); // 100
const temp3 = new TemperatureConverter().convert(212, "F", "C"); // 100
const temp4 = TemperatureConverter.convert(212)
.from("F")
.to("C"); // 100
Attribution
This module is based of the work of Ben Ng repository convert-units npm module. while functional, its not been maintained or updated in several years.