export function isStrictNumber()

in packages/@fbcmobile-ui/Utils/StringUtils.js [32:56]


export function isStrictNumber(text: string): boolean {
  const isDigit = (char: string): boolean => {
    return char >= '0' && char <= '9';
  };

  const isInteger = (str: string): boolean => {
    if (str == null || str.length == 0) {
      return false;
    }

    let index = 0;
    if (str[index] === '-') {
      // accept `-` only as the first character
      index = 1;
    }
    for (; index < str.length; index++) {
      if (!isDigit(str[index])) {
        return false;
      }
    }
    return true;
  };

  return isInteger(text);
}