Merge branch 'master' of git.curoverse.com:arvados-workbench2 into 13827-select-field...
[arvados-workbench2.git] / src / validators / is-number.tsx
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { isNumber as isNum } from 'lodash';
6 const ERROR_MESSAGE = 'This field can only contain numeric values';
7
8 export const isNumber = (value: any) => {
9     return !isNaN(value) && isNum(value) ? undefined : ERROR_MESSAGE;
10 };