packages/mip/src/util/dom/css.js
function unitProperty (property, value) {
  if (value !== +value) {
    return value
  }

  if (unitCache[property]) {
    return value + unitCache[property]
  }

  supportElement.style[property] = 0

  let propValue = supportElement.style[property]
  let match = propValue.match && propValue.match(UNIT_REG)

  if (match) {
    return value + (unitCache[property] = match[1])
  }

  return value
}
function unitProperty (property, value) {
  if (value !== +value) {
    return value
  }

  if (unitCache[property]) {
    return value + unitCache[property]
  }

  supportElement.style[property] = 0

  let propValue = supportElement.style[property]
  let match = propValue.match && propValue.match(UNIT_REG)

  if (match) {
    return value + (unitCache[property] = match[1])
  }

  return value
}
function unitProperty ( property , value ) { if ( value !== + value ) { return value } if ( unitCache [ property ] ) { return value + unitCache [ property ] } supportElement . style [ property ] = 0 let propValue = supportElement . style [ property ] let match = propValue . match && propValue . match ( UNIT_REG ) if ( match ) { return value + ( unitCache [ property ] = match [ 1 ] ) } return value }
Obtain the unit of a property and add it to the value has no unit if exists.

@param {string} property property
@param {(string|number)} value A value maybe needs unit.
@return {(string|number)}
Obtain the unit of a property and add it to the value has no unit if exists .