index.js
/**
* Verify if a given value's length does not exceed the given maximum length.
* For strings this will validate the number of characters.
* For numbers, this will validate the number of digits, including the decimal places, and the decimal mark.
*
* @public
* @since 0.1.0
* @param {!Number|String} value - The value to be validated.
* @param {!Number} maxLen - The maximum length allowed for the given value.
* @return {Boolean}
*
* @example
* var isValueNotTooLong = defy.maxlength('Example', 10)
*/
Verify if a given value's length does not exceed the given maximum length.
For strings this will validate the number of characters.
For numbers, this will validate the number of digits, including the decimal places, and the decimal mark.
Verify if a given value ' s length does not exceed the given maximum length . For strings this will validate the number of characters . For numbers this will validate the number of digits including the decimal places and the decimal mark .
function maxlength (value, maxLen) {
  let val = value
  if (typeof value === 'number') {
    val = normalizeValue(value)
  }
  const mxLength = parseInt(maxLen, 10)
  if (val.length > mxLength) {
    return false
  }
  return true
}
function maxlength ( value , maxLen ) { let val = value if ( typeof value === 'number' ) { val = normalizeValue ( value ) } const mxLength = parseInt ( maxLen , 10 ) if ( val . length > mxLength ) { return false } return true }
Verify if a given value's length does not exceed the given maximum length.
Verify if a given value ' s length does not exceed the given maximum length .