index.js
/**
* Verify if a given value does not exceed another given value.
* Both values will be treated as strings.
*
* @public
* @since 0.1.0
* @param {!Number|String} value - The value to be validated.
* @param {!Number|String} maxValue - The maximum allowed for the given value.
* @return {Boolean}
*
* @example
* var isValueLessThanEleven = defy.max(5, 10)
*/
Verify if a given value does not exceed another given value.
Both values will be treated as strings.
Verify if a given value does not exceed another given value . Both values will be treated as strings .
function max (value, maxValue) {
  let val = value
  let maxVal = maxValue
  if (normalizeValue(val).length !== normalizeValue(maxVal).length) {
    if (number(val)) {
      val = parseFloat(val)
    }
    if (number(maxVal)) {
      maxVal = parseFloat(maxVal)
    }
  }
  if (val > maxVal) {
    return false
  }
  return true
}
function max ( value , maxValue ) { let val = value let maxVal = maxValue if ( normalizeValue ( val ) . length !== normalizeValue ( maxVal ) . length ) { if ( number ( val ) ) { val = parseFloat ( val ) } if ( number ( maxVal ) ) { maxVal = parseFloat ( maxVal ) } } if ( val > maxVal ) { return false } return true }
Verify if a given value does not exceed another given value.
Verify if a given value does not exceed another given value .