function isD1Database
Since 0.2.0
isD1Database(value: unknown): value is ID1Database

Reports whether a binding is D1-shaped.

Read by D1Adapter's constructor, so an absent binding — a name typo, a missing d1_databases stanza, a preview environment that was never given the database — fails where the adapter is built, naming what is wrong, rather than at the first query with a bare TypeError.

Parameters

value: unknown

The binding to check

Return Type

value is ID1Database

true when it carries the D1 database methods

Usage

import { isD1Database } from "cloudflare-plugin/src/index.ts";