本文整理汇总了TypeScript中js-quantities.mul函数的典型用法代码示例。如果您正苦于以下问题:TypeScript mul函数的具体用法?TypeScript mul怎么用?TypeScript mul使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mul函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: it
it("should multiply temperature degrees", () => {
var qty = Qty("2degF");
var result = qty.mul(3);
expect(result.scalar).toBe(6);
expect(result.units()).toBe("degF");
result = qty.mul("3degF");
expect(result.scalar).toBe(6);
expect(result.units()).toBe("degF2");
// TODO: Should we convert degrees ("2 degK" to "degC") before we do the math?
qty = Qty("2degC");
result = qty.mul("2degK");
expect(result.scalar).toBe(4);
expect(result.units()).toBe("degC*degK");
qty = Qty("2degC");
result = qty.mul("degF");
expect(result.scalar).toBe(2);
expect(result.units()).toBe("degC*degF");
});
开发者ID:Kroisse,项目名称:DefinitelyTyped,代码行数:21,代码来源:js-quantities-tests.ts
示例2: expect
expect(() => { qty.mul("-1"); }).toThrow("Temperatures must not be less than absolute zero");
开发者ID:Kroisse,项目名称:DefinitelyTyped,代码行数:1,代码来源:js-quantities-tests.ts
示例3: expect
expect(function () { qty.mul("1 degC"); }).toThrow("Cannot multiply by temperatures");
开发者ID:ArtemZag,项目名称:DefinitelyTyped,代码行数:1,代码来源:js-quantities-tests.ts
注:本文中的js-quantities.mul函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论