vue-lynx / toValue

Function: toValue()

function toValue<T>(source): T

Normalizes values / refs / getters to values. This is similar to unref, except that it also normalizes getters. If the argument is a getter, it will be invoked and its return value will be returned.

Type Parameters

Type Parameter
T

Parameters

ParameterTypeDescription
sourceMaybeRefOrGetter<T>A getter, an existing ref, or a non-function value.

Returns

T

Example

toValue(1) // 1
toValue(ref(1)) // 1
toValue(() => 1) // 1

See

https://vuejs.org/api/reactivity-utilities.html#tovalue

Defined in

node_modules/.pnpm/@vue+reactivity@3.5.30/node_modules/@vue/reactivity/dist/reactivity.d.ts:526