Skip to content

Function: toTaggedValue()

@kortexya/reasoninglayer


@kortexya/reasoninglayer / toTaggedValue

Function: toTaggedValue()

toTaggedValue(value): ValueDto

Defined in: src/utils/convert.ts:98

Convert a single plain JavaScript value to tagged ValueDto format.

Parameters

value

PlainFeatureValue

Plain JavaScript value or already-tagged ValueDto.

Returns

ValueDto

Tagged ValueDto.

Remarks

Used by term CRUD and query endpoints. No ?/! prefix detection — all strings are treated as literal string values.

Conversion rules:

  • string{ type: "String", value: s }
  • number (integer) → { type: "Integer", value: n }
  • number (float) → { type: "Real", value: n }
  • boolean{ type: "Boolean", value: b }
  • null{ type: "Uninstantiated" }
  • PlainFeatureValue[]{ type: "List", value: [recursed] }
  • Already a ValueDto → passthrough

Throws

If the value cannot be converted (e.g., PsiTermInput or ConstrainedPlainVar).

Example

toTaggedValue("hello") // { type: "String", value: "hello" }
toTaggedValue(42) // { type: "Integer", value: 42 }
toTaggedValue(null) // { type: "Uninstantiated" }