Extract IntInput's format function
[arvados.git] / src / views / run-process-panel / inputs / int-input.tsx
index 413ee49c7abc0eee00961fd66f941e2b71ef19ad..cac8a27c7d31896344eb1e6886af46d568003e4b 100644 (file)
@@ -17,14 +17,18 @@ export const IntInput = ({ input }: IntInputProps) =>
         name={input.id}
         commandInput={input}
         component={InputComponent}
-        parse={value => parseInt(value, 10)}
-        format={value => isNaN(value) ? '' : JSON.stringify(value)}
+        parse={parse}
+        format={format}
         validate={[
             isRequiredInput(input)
                 ? isInteger
                 : () => undefined,
         ]} />;
 
+const parse = (value: any) => parseInt(value, 10);
+
+const format = (value: any) => isNaN(value) ? '' : JSON.stringify(value);
+
 const InputComponent = (props: GenericInputProps) =>
     <GenericInput
         component={Input}