es2015/object-store/ReadOnlyIndex.js
function toNativeCursorDirection(direction, unique) {
  if (typeof direction === "string") {
    if (CURSOR_DIRECTIONS.indexOf(direction.toUpperCase()) === -1) {
      throw new Error("When using a string as cursor direction, use NEXT " +
          `or PREVIOUS, ${direction} provided`);
    }
  } else {
    direction = direction.value
  }

  let cursorDirection = direction.toLowerCase().substring(0, 4)
  if (unique) {
    cursorDirection += "unique"
  }
  
  return cursorDirection
}
function toNativeCursorDirection(direction, unique) {
  if (typeof direction === "string") {
    if (CURSOR_DIRECTIONS.indexOf(direction.toUpperCase()) === -1) {
      throw new Error("When using a string as cursor direction, use NEXT " +
          `or PREVIOUS, ${direction} provided`);
    }
  } else {
    direction = direction.value
  }

  let cursorDirection = direction.toLowerCase().substring(0, 4)
  if (unique) {
    cursorDirection += "unique"
  }
  
  return cursorDirection
}
Returns the cursor direction to use with the native Indexed DB API.

@param {(CursorDirection|string)=} direction The direction in which the
cursor will traverse the records. Use either the
{@code CursorDirection.*} constants, or strings {@code "NEXT"} and
{@code "PREVIOUS"} (or {@code "PREV"} for short). The letter case
used in the strings does not matter.
@param {boolean=} unique When {@code true}, it cursor will skip over the
records stored with the same index key value.
@return {string} The cursor direction compatible with the native Indexed DB
API.