INNER CODE UNIT · TypeScript

executeOptions

planetscale/database-js · src/index.ts:185

function executeOptions(options: unknown, unsupported: unknown[]): { as?: ExecuteAs; cast?: Cast } {
  if (options == null) {
    options = {}
  }

  const isOptions =
    typeof options === 'object' &&
    !Array.isArray(options) &&
    Object.keys(options as object).every((key) => optionKeys.includes(key))

  if (unsupported.length > 0 || !isOptions) {
    throw new Error(
      'Query parameters are not supported: pass a complete SQL string and options to execute(query, options)'
    )
  }

  return options as { as?: ExecuteAs; cast?: Cast }
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…