function arrayFormat(query) {
  const keys = (query || '')
    .replace('?', '')
    .split('&')
    .map((str) => decodeURIComponent(str.split('=')[0]));

  for (const key of keys) {
    if (INDICES_REGEX.test(key)) {
      // a[0]=b&a[1]=c
      return 'indices';
    } else if (BRACKETS_REGEX.test(key)) {
      // a[]=b&a[]=c
      return 'brackets';
    }
  }

  // Look to see if any key has a duplicate
  const hasDuplicate = keys.some((key, index) => keys.indexOf(key) !== index);

  if (hasDuplicate) {
    // 'a=b&a=c'
    return 'repeat';
  }
}
Given a query string, determine the array format used. Returns `undefined`
if one cannot be determined.

@param {String} query
@returns {String | undefined}