Validate the numVisible value.

@method _validateNumVisible
@param val {Number} The numVisible value
@return {Boolean} The status of the validation
@protected
967659
function (val) {
            var rv = false;

            if (JS.isNumber(val)) {
                rv = val > 0 && val <= this.get("numItems");
            } else if (JS.isArray(val)) {
                if (JS.isNumber(val[0]) && JS.isNumber(val[1])) {
                    rv = val[0] * val[1] > 0 && val.length == 2;
                }
            }

            return rv;
        }
945122
function(val) {
      return val === undefined ? (this.length ? this[0].clientWidth || this[0].innerWidth : 0) : this.each(function(index, el) {
        el.style.width = val + 'px';
      });
    }
1226116
function (val) {
            var carousel = this, numItems = carousel.get("numItems");

            if (JS.isNumber(val)) {
                if (numItems === 0 && val == numItems) {
                    return true;
                } else {
                    return (val >= 0 && val < numItems);
                }
            }

            return false;
        }
916832
public Item withNumber(String attrName, Number val) {
        checkInvalidAttribute(attrName, val);
        attributes.put(attrName, toBigDecimal(val));
        return this;
    }
891154
public static function alphaNum($val): bool
    {
        if (!\is_string($val) && !\is_numeric($val)) {
            return false;
        }

        return 1 === \preg_match('/^(?:[a-zA-Z0-9]+)$/', $val);
    }
1337423
function isNumber( value ) {
	return ( typeof value === 'number' || Object.prototype.toString.call( value ) === '[object Number]' ) && value.valueOf() === value.valueOf();
}
985784
function isArrayLike(val) {
  return val != null && (isArray(val) || (val !== 'function' && isNumber(val.length)));
}
535720
function mkNumber(val) {
            var sign = 1;
            if (val.charAt(0) == '-') {
                sign = -1;
                val = val.substring(1);
            }
            if (Lang.NUMBER_DEC.test(val))
                return sign * parseInt(val, 10);
            else if (Lang.NUMBER_HEX.test(val))
                return sign * parseInt(val.substring(2), 16);
            else if (Lang.NUMBER_OCT.test(val))
                return sign * parseInt(val.substring(1), 8);
            else if (val === 'inf')
                return sign * Infinity;
            else if (val === 'nan')
                return NaN;
            else if (Lang.NUMBER_FLT.test(val))
                return sign * parseFloat(val);
            throw Error("illegal number value: " + (sign < 0 ? '-' : '') + val);
        }
561953
public function val($val = null) {
		$val = (int) $val;
		if ($val) {
			if (is_numeric($val) && is_int($val*1)) {
				if (in_array($this->sources[$val],$this->sources)) {
					$this->val = $val;
					return $this->val;
				}
			} else {
				throw new \SimplOn\DataValidationException($this->valudationNaN);
			}
		} else {
			return $this->val;
		}
	}
566927
function financialNumber (value) {
  const num = Number(value)
  if (value !== num || num < -99999999.99 || num > 99999999.99) {
    throw new Error(`Value '${value}' is not a valid number.`)
  }
}
792840
function required (val, arg) {
  var isRequired = arg === undefined ? true : arg;
  if (Array.isArray(val)) {
    if (val.length !== 0) {
      var valid = true;
      for (var i = 0, l = val.length; i < l; i++) {
        valid = required(val[i], isRequired);
        if ((isRequired && !valid) || (!isRequired && valid)) {
          break
        }
      }
      return valid
    } else {
      return !isRequired
    }
  } else if (typeof val === 'number' || typeof val === 'function') {
    return isRequired
  } else if (typeof val === 'boolean') {
    return val === isRequired
  } else if (typeof val === 'string') {
    return isRequired ? (val.length > 0) : (val.length <= 0)
  } else if (val !== null && typeof val === 'object') {
    return isRequired ? (Object.keys(val).length > 0) : (Object.keys(val).length <= 0)
  } else if (val === null || val === undefined) {
    return !isRequired
  } else {
    return !isRequired
  }
}
922498
public static int parseInt(String val, int defValue){
        if(TextUtils.isEmpty(val)) return defValue;
        try{
            return Integer.parseInt(val);
        }catch (NumberFormatException e){
            return defValue;
        }
    }
582543
function(val, req, attribute) {
    if (val) {
      req = parseFloat(req);

      var size = this.getSize();

      return size === req;
    }

    return true;
  }
1144370
def validate(self, val):
        """"""
        if self.validation:
            self.type.validate(val)

            if self.custom_validator is not None:
                self.custom_validator(val)

        return True
1278447
function validateValueByRule(accumulator, value, key, property, rule) {
  // If value is not an object, we can't validate it by the rule.
  // A previous validator will have reported this error.
  if (!isObject(value)) {
    return accumulator;
  }

  // property does not exist on value, this is valid
  if (!Object.prototype.hasOwnProperty.call(value, property)) {
    return accumulator;
  }

  const propertyValue = value[property];
  if (propertyValue === undefined) {
    accumulator.errors.push(new Error(`property "${property}" is undefined for key "${key}"`));
    return accumulator;
  }

  switch (rule.type) {
    case 'equal':
      if (
        !isString(propertyValue)
        && !isNumber(propertyValue)
        && !isBoolean(propertyValue)
      ) {
        accumulator.errors.push(new Error(`equal property "${property}" must be a string, number, or boolean for key "${key}"`));
      }
      break;
    case 'list':
      if (!Array.isArray(propertyValue)) {
        accumulator.errors.push(new Error(`list property "${property}" must be an array for key "${key}"`));
        return accumulator;
      }
      propertyValue.forEach((listValue) => {
        if (
          !isString(listValue)
          && !isNumber(listValue)
          && !isBoolean(listValue)
        ) {
          accumulator.errors.push(new Error(`values in list property "${property}" must be a string, number, or boolean for key "${key}"`));
        }
      });
      break;
    case 'percent':
      if (
        !isNumber(propertyValue)
        || propertyValue > 100
        || propertyValue < 0
      ) {
        accumulator.errors.push(new Error(`percent property "${property}" must be a number between 0 and 100 inclusive for key "${key}"`));
      } else {
        accumulator.percentTotal += propertyValue;
      }
      break;
    /* eslint default-case: 0 */
  }

  return accumulator;
}
5500
def valid_input(val):
        
        # looks for 3 nums followed by a dot 3 times and then ending with
        # 3 nums, can be proceeded by any number of spaces
        ip_value = re.compile(r'(\d{1,3}\.){3}\d{1,3}$')
        # looks for only numbers and commas (because priorities can have commas
        # between them), can be proceeded by any number of spaces
        all_num = re.compile(r'(\d,?\ *)+$')
        sections_comments = re.compile(r"""
        \ *\#.*             # comments (any number of whitespace, then #
                            # followed by anything)

        | \[[\w-]+\]$       # section headers (any combination of chars, nums,
                            # underscores, and dashes between brackets)
        """, re.VERBOSE)
        # can't can be a comment on option side and value side can't have
        # [, ], {, or } otherwise it is turned over to literal_eval for
        # checkout
        options_values = re.compile(r'[^# ]+\ *=[^[\]{}]*$')
        line_num = 0
        warning_str = ''
        error_str = ''
        trimmed_val = []
        for entry in val.split('\n'):
            line_num += 1
            # get rid of any extraneous commas at the end of a dict and remove
            # extra whitespace from input
            trimmed_val.append(re.sub(r',\ *}', '}', entry).strip())
            # empty line
            if entry.strip() == '':
                continue
            # look at regular (non dictionary or list) option-value pairs
            if options_values.match(entry):
                value = entry.split('=', 1)[1]
                # deal with potentially more equals signs
                for val in value.split('='):
                    val = val.strip()
                    # empty val means malformed equals signs
                    if val == '':
                        error_str += '-You have a misplaced equals sign on' \
                            ' line ' + str(line_num) + '\n'
                    # starts with a num; look for bad ip input or warn user
                    # about having extraneous characters in number input
                    if re.match('\ *\d', val):
                        # bad ip syntax
                        if val.find('.') >= 0 and not ip_value.match(val):
                            error_str += '-You have an incorrectly' \
                                ' formatted ip address (bad syntax) at' \
                                ' line ' + str(line_num) + '\n'
                        # possibly malformed numbers
                        elif val.find('.') < 0 and not all_num.match(val):
                            warning_str += '-Line starting with a number has' \
                                ' characters mixed in at line ' + \
                                str(line_num) + '\n'
                        # bad ip values
                        elif val.find('.') >= 0:
                            for num in val.strip().split('.'):
                                num = int(num)
                                if num > 255 or num < 0:
                                    error_str += '-You have an incorrectly' \
                                        ' formatted ip address (values' \
                                        ' exceeding 255 or below 0) at' \
                                        ' line ' + str(line_num) + '\n'
                    # ensure no lines end with a comma (most likely extraneous
                    # commas from groups or priorities)
                    if re.search(',$', val):
                        error_str += '-You have an incorrect comma at the' \
                            ' end of line ' + str(line_num) + '\n'
            # see if input is a header or comment, otherwise try to
            # literal_eval it to ensure correct structure
            elif not sections_comments.match(entry):
                lit_val = ''
                try:
                    opt_val = entry.split('=', 1)
                    if opt_val[0].strip() == '':
                        error_str += '-You have nothing preceeding an' \
                            ' equals sign at line ' + str(line_num) + '\n'
                    else:
                        lit_val = opt_val[1].strip()
                except IndexError:
                    lit_val = ''
                    error_str += '-You have an incorrectly formatted' \
                        ' section header at line ' + str(line_num) + '\n'
                if lit_val:
                    try:
                        ast.literal_eval(lit_val)
                    except SyntaxError:
                        error_str += '-You have an incorrectly formatted' \
                            ' list/dictionary at line ' + str(line_num) + \
                            '\n'

        if error_str:
            npyscreen.notify_confirm('You have the following error(s) and'
                                     " can't proceed until they are fixed:" +
                                     '\n' + '-'*50 + '\n' + error_str,
                                     title='Error in input')
            return (False, '')
        elif warning_str:
            res = npyscreen.notify_yes_no('You have may have some error(s)'
                                          ' that you want to check before'
                                          ' proceeding:' + '\n' + '-'*50 +
                                          '\n' + warning_str + '\n' + '-'*50 +
                                          '\n' + 'Do you want to continue?',
                                          title='Double check')
            return (res, '\n'.join(trimmed_val))
        return (True, '\n'.join(trimmed_val))
604097
function(val) {
    if (/^(?:auto|inherit)$/.test(val)) {
      return val;
    }
    var zIndex;
    if (typeof val === "number" && !_isNaN(val)) {
      zIndex = val;
    } else if (typeof val === "string") {
      zIndex = _getSafeZIndex(_parseInt(val, 10));
    }
    return typeof zIndex === "number" ? zIndex : "auto";
  }