function processSizesWildcard (sizes, currentLength) {
  const newLength = product(sizes)
  const processedSizes = sizes.slice()
  const WILDCARD = -1
  const wildCardIndex = sizes.indexOf(WILDCARD)

  const isMoreThanOneWildcard = sizes.indexOf(WILDCARD, wildCardIndex + 1) >= 0
  if (isMoreThanOneWildcard) {
    throw new Error('More than one wildcard in sizes')
  }

  const hasWildcard = wildCardIndex >= 0
  const canReplaceWildcard = currentLength % newLength === 0

  if (hasWildcard) {
    if (canReplaceWildcard) {
      processedSizes[wildCardIndex] = -currentLength / newLength
    } else {
      throw new Error('Could not replace wildcard, since ' + currentLength + ' is no multiple of ' + (-newLength))
    }
  }
  return processedSizes
}
Replaces the wildcard -1 in the sizes array.
@param {number[]} sizes  List of sizes for each dimension. At most one wildcard.
@param {number} currentLength  Number of elements in the array.
@throws {Error}                If more than one wildcard or unable to replace it.
@returns {number[]}      The sizes array with wildcard replaced.