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