function isScanIndexOptions(options) {
  return options.indexName !== void 0;
}
function normalizeScanOptionIndexedStartKey(startKey) {
  if (typeof startKey === "string") {
    return [startKey];
  }
  return startKey;
}
function toDbScanOptions(options) {
  if (!options) {
    return {};
  }
  let key;
  let exclusive;
  let primary;
  let secondary;
  if (options.start) {
    ({ key, exclusive } = options.start);
    if (options.indexName) {
      if (typeof key === "string") {
        secondary = key;
      } else {
        secondary = key[0];
        primary = key[1];
      }
    } else {
      primary = key;
    }
  }
  return {
    prefix: options.prefix,
    startSecondaryKey: secondary,
    startKey: primary,
    startExclusive: exclusive,
    limit: options.limit,
    indexName: options.indexName
  };
}
export {
  isScanIndexOptions,
  normalizeScanOptionIndexedStartKey,
  toDbScanOptions
};
//# sourceMappingURL=scan-options.js.map
