Setu-TS
    Preparing search index...

    Function splitWorkerEnv

    • Partitions a Workers env record by value type.

      Values that are neither a string nor a non-null object (a number, a boolean, null, undefined) land in neither half: coercing them to a string would put a value in env that was never a variable, and treating them as a binding would hand a caller something with no methods.

      Parameters

      • env: Readonly<Record<string, unknown>>

        The record the Worker's env provides

      Returns SplitWorkerEnv

      The string variables and the object bindings, separated

      const { vars, bindings } = splitWorkerEnv({ API_KEY: 'k', CACHE: kvNamespace });
      // vars → { API_KEY: 'k' }
      // bindings → { CACHE: kvNamespace }

      0.2.0