src/index.js
function getValueDoppelganger(key, originalValue) {
  /* eslint complexity:[2, 9] */ // let's try to keep the complexity down... If we have to do this much more, let's break this up
  if (isNullOrUndefined(originalValue) || isBoolean(originalValue)) {
    return originalValue
  }

  if (isObject(originalValue)) {
    return convert(originalValue) // recurssion 🌀
  }
  const isNum = isNumber(originalValue)
  const importantlessValue = isNum
    ? originalValue
    : originalValue.replace(/ !important.*?$/, '')
  const isImportant =
    !isNum && importantlessValue.length !== originalValue.length
  const valueConverter = propertyValueConverters[key]
  let newValue
  if (valueConverter) {
    newValue = valueConverter({
      value: importantlessValue,
      valuesToConvert,
      isRtl: true,
      bgImgDirectionRegex,
      bgPosDirectionRegex,
    })
  } else {
    newValue = valuesToConvert[importantlessValue] || importantlessValue
  }
  if (isImportant) {
    return `${newValue} !important`
  }
  return newValue
}
function getValueDoppelganger(key, originalValue) {
  /* eslint complexity:[2, 9] */ // let's try to keep the complexity down... If we have to do this much more, let's break this up
  if (isNullOrUndefined(originalValue) || isBoolean(originalValue)) {
    return originalValue
  }

  if (isObject(originalValue)) {
    return convert(originalValue) // recurssion 🌀
  }
  const isNum = isNumber(originalValue)
  const importantlessValue = isNum
    ? originalValue
    : originalValue.replace(/ !important.*?$/, '')
  const isImportant =
    !isNum && importantlessValue.length !== originalValue.length
  const valueConverter = propertyValueConverters[key]
  let newValue
  if (valueConverter) {
    newValue = valueConverter({
      value: importantlessValue,
      valuesToConvert,
      isRtl: true,
      bgImgDirectionRegex,
      bgPosDirectionRegex,
    })
  } else {
    newValue = valuesToConvert[importantlessValue] || importantlessValue
  }
  if (isImportant) {
    return `${newValue} !important`
  }
  return newValue
}
function getValueDoppelganger ( key , originalValue ) { /* eslint complexity:[2, 9] */ // let's try to keep the complexity down... If we have to do this much more, let's break this up if ( isNullOrUndefined ( originalValue ) || isBoolean ( originalValue ) ) { return originalValue } if ( isObject ( originalValue ) ) { return convert ( originalValue ) // recurssion 🌀 } const isNum = isNumber ( originalValue ) const importantlessValue = isNum ? originalValue : originalValue . replace ( /  !important.*?$ / , '' ) const isImportant = ! isNum && importantlessValue . length !== originalValue . length const valueConverter = propertyValueConverters [ key ] let newValue if ( valueConverter ) { newValue = valueConverter ( { value : importantlessValue , valuesToConvert , isRtl : true , bgImgDirectionRegex , bgPosDirectionRegex , } ) } else { newValue = valuesToConvert [ importantlessValue ] || importantlessValue } if ( isImportant ) { return ` ${ newValue } ` } return newValue }
This converts the given value to the RTL version of that value based on the key
@param {String} key this is the key (note: this should be the RTL version of the originalKey)
@param {String|Number|Object} originalValue the original css property value. If it's an object, then we'll convert that as well
@return {String|Number|Object} the converted value
This converts the given value to the RTL version of that value based on the key