Converts a value to an integer.
@private
@param {*} value
@returns {Number}
355934
function _toInteger (value) {
    var n = +value;

    if (n !== n) { // eslint-disable-line no-self-compare
        return 0;
    } else if (n % 1 === 0) {
        return n;
    } else {
        return Math.floor(Math.abs(n)) * (n < 0 ? -1 : 1);
    }
}
1233082
def validate_int(value):
    

    if value and not isinstance(value, int):
        try:
            int(str(value))
        except (TypeError, ValueError):
            raise ValidationError('not a valid number')
    return value
67072
def to_int(value: Any) -> int:
        

        if isinstance(value, (bool, int)):
            return int(value)
        return int(str(value))
906389
function(num) {
    num = parseInt(num);

    if (num < 10) {
      num = '0' + num;
    } else {
      num = num.toString();
    }

    return num;
  }
264472
private Object parseValue(String value) {

        // Try to parse value as number
        try {
            return Double.valueOf(value);
        } catch (NumberFormatException ignored){}

        if (value.equals("true") || value.equals("false"))
            return Boolean.valueOf(value);

        throw new IllegalArgumentException("Only number or boolean stats values allowed");

    }
895669
public int intValue() {
		int value;
		value = Integer.parseInt(this.param);
		if(this.isNeg) value = (-value);
		return value;
	}
224257
private static Object toInt( BigDecimal value)
    {
    Object number;
        
    try
      {
      number =
        value.scale() == 0
        ? Integer.valueOf( value.intValueExact())
        : null;
      }
    catch( Exception e)
      {
      number = null;
      }
        
    return number;
    }
784764
function toInteger(val, def) {
    if (!is_1.isValue(val))
        return toDefault(null, def);
    var parsed = function_1.tryWrap(parseInt, val)(def);
    if (is_1.isInteger(parsed))
        return parsed;
    if (toBoolean(val))
        return 1;
    return 0;
}
1073332
public Integer convertStringToInteger(String value) {
        Integer result;
        try {
            result = Integer.valueOf(value);
        } catch (NumberFormatException e) {
            result = DEFAULT_INT_VALUE;
        }
        return result;

    }
279111
function (value) {
            if (this.options) {
                for (var i = 0, l = this.options.length; i < l; i++) {
                    if (this.options[i].value === value) {
                        return i;
                    }
                }
            }
            return -1;
        }
18512
public static int toInteger(Object value, int defaultValue) {
		if (value == null || value.toString().trim().equals("")) {
			return defaultValue;
		}
		if (value instanceof Integer) {
			return (Integer) value;
		}
		return (int) JKConversionUtil.toDouble(value);
	}
303222
public static int asInteger(Object value) {
        if (value instanceof Number) {
            return ((Number) value).intValue();
        } else if (value instanceof Numeric) {
            return ((Numeric) value).asInteger();
        } else if (value instanceof Boolean) {
            return ((Boolean) value) ? 1 : 0;
        } else if (value instanceof CharSequence) {
            try {
                return Integer.parseInt(value.toString());
            } catch (NumberFormatException nfe) {
                throw new IncompatibleValueException(
                        "Unable to parse string \"" + Strings.escape(value.toString()) +
                        "\" to an int", nfe);
            }
        } else if (value instanceof Date) {
            // Convert date timestamp to seconds since epoch.
            return (int) (((Date) value).getTime() / 1000);
        }
        throw new IncompatibleValueException("Unable to convert " + value.getClass().getSimpleName() + " to an int");
    }
426131
def is_integer(self, value, strict=False):
        """"""
        if value is not None:
            if isinstance(value, numbers.Number):
                return
        value = stringify(value)
        if value is not None and value.isnumeric():
            return
        self.shout('value %r is not an integer', strict, value)
467601
function number(value) {
  var parsedNumber = Number.parseInt(value, 10);

  // couldn't parse it
  if (typeOf(parsedNumber) != 'number') {
    return throwModifierError('number', value, {message: 'Invalid Number'});
  }

  return parsedNumber;
}
1219847
function convertToNumber(value) {
    if (_.isString(value)) {
        value = value.replace(/,/g, '');
    }

    if (_.isNumber(value) || isNaN(value) || util.isBlank(value)) {
        return value;
    }

    return Number(value);
}
1367818
function coerceValue(value) {

    let numValue = coerceNumber(value);

    if (numValue === value) {
        return coerceDate(value);
    }

    return numValue;
}
1157521
public static Integer toInt(Object value, Integer defaultValue) {
		return convert(Integer.class, value, defaultValue);
	}