@td-design/react-native
Version:
react-native UI组件库
21 lines • 496 B
JavaScript
/**
* 格式化输入的值
* @param value 输入的值
* @param type 类型
* @param digit 小数位数
* @returns
*/
export function formatValue(value, type) {
let digit = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 2;
if (!value || !type) return value;
switch (type) {
case 'idcard':
default:
return value;
case 'integer':
return +value;
case 'number':
return (+value).toFixed(digit);
}
}
//# sourceMappingURL=util.js.map