utils

Home > @silence_zhpf/utils > Money

Money class

Money 类表示货币值,并提供用于创建、添加、减去、格式化以及将值转换为字符串的方法。

Signature:

export declare class Money 

Remarks

The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the Money class.

Methods

Method Modifiers Description
add(other)   此函数将两个 Money 对象的值相加并返回一个新的 Money 对象及其总和。
div(factor)   此函数把一个Money对象缩小到指定的倍数,并返回一个新的Monkey对象。
mul(factor)   此函数把一个Money对象的值扩大指定的倍数,并返回一个新的Money对象。
new(value) static 此函数创建具有给定值的 Money 类的新实例。
sub(other)   此函数从一个 Money 对象的值中减去另一个,并返回一个新的 Money 对象和结果。
toChinese(precision)    
toString()   this.value 的数值转换为字符串值并返回。