Refactor function to a separate file
[MAILPOET-2835]
This commit is contained in:
@@ -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 {
|
||||
|
10
assets/js/src/form_editor/store/server_value_as_num.ts
Normal file
10
assets/js/src/form_editor/store/server_value_as_num.ts
Normal 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;
|
Reference in New Issue
Block a user