src/core/components/files-regular/utils.js
function parseRabinString (chunker) {
  const options = {}
  const parts = chunker.split('-')
  switch (parts.length) {
    case 1:
      options.avgChunkSize = 262144
      break
    case 2:
      options.avgChunkSize = parseChunkSize(parts[1], 'avg')
      break
    case 4:
      options.minChunkSize = parseChunkSize(parts[1], 'min')
      options.avgChunkSize = parseChunkSize(parts[2], 'avg')
      options.maxChunkSize = parseChunkSize(parts[3], 'max')
      break
    default:
      throw new Error('Incorrect chunker format (expected "rabin" "rabin-[avg]" or "rabin-[min]-[avg]-[max]"')
  }

  return options
}
function parseRabinString (chunker) {
  const options = {}
  const parts = chunker.split('-')
  switch (parts.length) {
    case 1:
      options.avgChunkSize = 262144
      break
    case 2:
      options.avgChunkSize = parseChunkSize(parts[1], 'avg')
      break
    case 4:
      options.minChunkSize = parseChunkSize(parts[1], 'min')
      options.avgChunkSize = parseChunkSize(parts[2], 'avg')
      options.maxChunkSize = parseChunkSize(parts[3], 'max')
      break
    default:
      throw new Error('Incorrect chunker format (expected "rabin" "rabin-[avg]" or "rabin-[min]-[avg]-[max]"')
  }

  return options
}
function parseRabinString ( chunker ) { const options = { } const parts = chunker . split ( '-' ) switch ( parts . length ) { case 1 : options . avgChunkSize = 262144 break case 2 : options . avgChunkSize = parseChunkSize ( parts [ 1 ] , 'avg' ) break case 4 : options . minChunkSize = parseChunkSize ( parts [ 1 ] , 'min' ) options . avgChunkSize = parseChunkSize ( parts [ 2 ] , 'avg' ) options . maxChunkSize = parseChunkSize ( parts [ 3 ] , 'max' ) break default : throw new Error ( 'Incorrect chunker format (expected "rabin" "rabin-[avg]" or "rabin-[min]-[avg]-[max]"' ) } return options }
Parses rabin chunker string

@param  {String}   chunker Chunker algorithm supported formats:
"rabin"
"rabin-{avg}"
"rabin-{min}-{avg}-{max}"

@return {Object}   rabin chunker options
Parses rabin chunker string