Skip to content

Function: toTaggedValue()

@kortexya/reasoninglayer


@kortexya/reasoninglayer / toTaggedValue

toTaggedValue(value): ValueDto

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

Convert a single plain JavaScript value to tagged ValueDto format.

PlainFeatureValue

Plain JavaScript value or already-tagged ValueDto.

ValueDto

Tagged ValueDto.

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

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

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