Refactor function to a separate file

[MAILPOET-2835]
This commit is contained in:
Pavel Dohnal
2020-04-28 15:42:53 +02:00
committed by Veljko V
parent d7b514d526
commit f9ea393b07
6 changed files with 33 additions and 10 deletions

View File

@@ -1,11 +1,4 @@
function asNum(num) {
const numI = parseInt(num, 10);
if (Number.isNaN(numI)) {
return undefined;
}
return numI;
}
import asNum from './server_value_as_num';
export default function mapFormDataAfterLoading(data) {
return {

View File

@@ -0,0 +1,10 @@
function asNum(num?: string): number | undefined {
const numI = parseInt(num, 10);
if (Number.isNaN(numI)) {
return undefined;
}
return numI;
}
export default asNum;