src/index.js
function iterate(prop, value, options) {
  if (!value) return value

  let convertedValue = value

  let type = typeof value
  if (type === 'object' && Array.isArray(value)) type = 'array'

  switch (type) {
    case 'object':
      if (prop === 'fallbacks') {
        for (const innerProp in value) {
          value[innerProp] = iterate(innerProp, value[innerProp], options)
        }
        break
      }
      for (const innerProp in value) {
        value[innerProp] = iterate(`${prop}-${innerProp}`, value[innerProp], options)
      }
      break
    case 'array':
      for (let i = 0; i < value.length; i++) {
        value[i] = iterate(prop, value[i], options)
      }
      break
    case 'number':
      if (value !== 0) {
        convertedValue = value + (options[prop] || units[prop] || '')
      }
      break
    default:
      break
  }

  return convertedValue
}
function iterate(prop, value, options) {
  if (!value) return value

  let convertedValue = value

  let type = typeof value
  if (type === 'object' && Array.isArray(value)) type = 'array'

  switch (type) {
    case 'object':
      if (prop === 'fallbacks') {
        for (const innerProp in value) {
          value[innerProp] = iterate(innerProp, value[innerProp], options)
        }
        break
      }
      for (const innerProp in value) {
        value[innerProp] = iterate(`${prop}-${innerProp}`, value[innerProp], options)
      }
      break
    case 'array':
      for (let i = 0; i < value.length; i++) {
        value[i] = iterate(prop, value[i], options)
      }
      break
    case 'number':
      if (value !== 0) {
        convertedValue = value + (options[prop] || units[prop] || '')
      }
      break
    default:
      break
  }

  return convertedValue
}
function iterate ( prop , value , options ) { if ( ! value ) return value let convertedValue = value let type = typeof value if ( type === 'object' && Array . isArray ( value ) ) type = 'array' switch ( type ) { case 'object' : if ( prop === 'fallbacks' ) { for ( const innerProp in value ) { value [ innerProp ] = iterate ( innerProp , value [ innerProp ] , options ) } break } for ( const innerProp in value ) { value [ innerProp ] = iterate ( ` ${ prop } ${ innerProp } ` , value [ innerProp ] , options ) } break case 'array' : for ( let i = 0 ; i < value . length ; i ++ ) { value [ i ] = iterate ( prop , value [ i ] , options ) } break case 'number' : if ( value !== 0 ) { convertedValue = value + ( options [ prop ] || units [ prop ] || '' ) } break default : break } return convertedValue }
Recursive deep style passing function

@param {String} current property
@param {(Object|Array|Number|String)} property value
@param {Object} options
@return {(Object|Array|Number|String)} resulting value
Recursive deep style passing function