lib/validators/type.js
function num(type, value) {
  var val;
  if(type === NUMERIC.INTEGER) {
    val = utils.strtoint(value);
    if(isNaN(val)) throw IntegerRange;
  }else{
    val = utils.strtofloat(value);
    if(isNaN(val)) throw InvalidFloat;
  }
  return val;
}
function num(type, value) {
  var val;
  if(type === NUMERIC.INTEGER) {
    val = utils.strtoint(value);
    if(isNaN(val)) throw IntegerRange;
  }else{
    val = utils.strtofloat(value);
    if(isNaN(val)) throw InvalidFloat;
  }
  return val;
}
function num ( type , value ) { var val ; if ( type === NUMERIC . INTEGER ) { val = utils . strtoint ( value ) ; if ( isNaN ( val ) ) throw IntegerRange ; } else { val = utils . strtofloat ( value ) ; if ( isNaN ( val ) ) throw InvalidFloat ; } return val ; }
Helper for testing numeric types.

Throws an error if the coerced type is NaN.

@param type The type constant.
@param value The value to test.

@return The coerced value.
Helper for testing numeric types .