# All files / internalHelpers _reduceHexValue.js

100% Statements 4/4
100% Branches 6/6
100% Functions 1/1
100% Lines 4/4

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15

    23x
    57x
    26x

    31x

     // @flow

    /**
     * Reduces hex values if possible e.g. #ff8866 to #f86
     * @private
     */
    const reduceHexValue = (value: string): string => {
      if (value.length === 7 && value[1] === value[2] && value[3] === value[4] && value[5] === value[6]) {
        return `#${value[1]}${value[3]}${value[5]}`
      }
      return value
    }

    export default reduceHexValue