admin-vben5/packages/effects/common-ui/src/components/captcha/utils.ts
Squall2017 5ba3a9dec2
refactor: refactor code structure and improve demo page (#4389)
* feat: captcha example

* fix: fix lint errors

* chore: event handling and methods

* chore: add accessibility features ARIA labels and roles

* refactor: refactor code structure and improve captcha demo page

* feat: add captcha internationalization

* chore: 适配时间戳国际化展示

---------

Co-authored-by: vince <vince292007@gmail.com>
2024-09-14 09:53:06 +08:00

8 lines
203 B
TypeScript

export const parseValue = (value: number | string) => {
if (typeof value === 'number') {
return value;
}
const parsed = Number.parseFloat(value);
return Number.isNaN(parsed) ? 0 : parsed;
};