lib/validator.js
function LENGTH_VALIDATOR(v) {
  v = (v || '').toString()
  var match = v.match(LENGTH_REGEXP)

  if (match) {
    var unit = match[1]
    if (!unit) {
      return {value: parseFloat(v)}
    }
    else if (SUPPORT_CSS_UNIT.indexOf(unit) > -1) {
      return {value: v}
    }
    else {
      return {
        value: parseFloat(v),
        reason: function reason(k, v, result) {
          return 'NOTE: unit `' + unit + '` is not supported and property value `' + v + '` is autofixed to `' + result + '`'
        }
      }
    }
  }

  return {
    value: null,
    reason: function reason(k, v, result) {
      return 'ERROR: property value `' + v + '` is not supported for `' + util.camelCaseToHyphened(k) + '` (only number and pixel values are supported)'
    }
  }
}
function LENGTH_VALIDATOR(v) {
  v = (v || '').toString()
  var match = v.match(LENGTH_REGEXP)

  if (match) {
    var unit = match[1]
    if (!unit) {
      return {value: parseFloat(v)}
    }
    else if (SUPPORT_CSS_UNIT.indexOf(unit) > -1) {
      return {value: v}
    }
    else {
      return {
        value: parseFloat(v),
        reason: function reason(k, v, result) {
          return 'NOTE: unit `' + unit + '` is not supported and property value `' + v + '` is autofixed to `' + result + '`'
        }
      }
    }
  }

  return {
    value: null,
    reason: function reason(k, v, result) {
      return 'ERROR: property value `' + v + '` is not supported for `' + util.camelCaseToHyphened(k) + '` (only number and pixel values are supported)'
    }
  }
}
function LENGTH_VALIDATOR ( v ) { v = ( v || '' ) . toString ( ) var match = v . match ( LENGTH_REGEXP ) if ( match ) { var unit = match [ 1 ] if ( ! unit ) { return { value : parseFloat ( v ) } } else if ( SUPPORT_CSS_UNIT . indexOf ( unit ) > - 1 ) { return { value : v } } else { return { value : parseFloat ( v ) , reason : function reason ( k , v , result ) { return 'NOTE: unit `' + unit + '` is not supported and property value `' + v + '` is autofixed to `' + result + '`' } } } } return { value : null , reason : function reason ( k , v , result ) { return 'ERROR: property value `' + v + '` is not supported for `' + util . camelCaseToHyphened ( k ) + '` (only number and pixel values are supported)' } } }
the values below is valid
- number
- number + 'px'

@param {string} v
@return {function} a function to return
- value: number|null
- reason(k, v, result)
the values below is valid - number - number + px