function refGetValue
refGetValue<T>(
ctx: Context | null | undefined,
refOrValue: RefValue<T> | NoInfer<T>
): NoInfer<T> | undefined

Retrieves the value from a reference or returns the value directly if it's not a reference.

This function is a utility that handles both reference values and literal values. If the input is a reference, it attempts to resolve it using the provided context. If the input is not a reference, it returns the value as-is.

Type Parameters

Parameters

ctx: Context | null | undefined

The context to use for resolving references

refOrValue: RefValue<T> | NoInfer<T>

Either a reference value or a literal value

Return Type

NoInfer<T> | undefined

The resolved value or the literal value, or undefined if the reference cannot be resolved

Usage

import { refGetValue } from "mod.ts";