Files
esengine/packages/core/src/Utils/Extensions/NumberExtension.ts
T

15 lines
383 B
TypeScript
Raw Normal View History

/**
* 数字扩展工具类
* 提供数字转换的实用方法
*/
export class NumberExtension {
/**
* 将值转换为数字
* @param value 要转换的值
* @returns 转换后的数字,如果值为undefined则返回0
*/
2025-07-31 11:56:04 +08:00
public static toNumber(value: unknown): number {
if (value == undefined) return 0;
return Number(value);
}
}