toValue
toValue(
input,attributeName?):ArkivValue
Defined in: src/schema/values.ts:556
Resolves a ValueInput to a typed value, applying the bare-form defaults above. Tagged values pass through untouched.
Parameters
Section titled “Parameters”The value to resolve.
attributeName?
Section titled “attributeName?”string
The attribute this value belongs to, used to make errors name it.
Returns
Section titled “Returns”Throws
Section titled “Throws”If the input is undefined or null — an attribute is either set
with a value and a type, or not set at all.
Throws
Section titled “Throws”If the input is not a tagged value or a bare boolean, number, bigint,
string or Uint8Array.
Throws
Section titled “Throws”If a bare value does not fit the type it defaults to.
Example
Section titled “Example”toValue(10) // i32(10)toValue(10n) // u256(10n)toValue("hello") // str("hello")toValue(dec("3.5")) // unchanged