Skip to main content

@idpass/data-collect-core / normalizeLegacyRelationField

Function: normalizeLegacyRelationField()

normalizeLegacyRelationField(value): unknown

Defined in: utils/normalizeLegacyRelationFields.ts:27

Normalizes a legacy [id, label] tuple format to just the ID value. This is used when pulling data from OpenSPP to ensure consistent storage format.

Parameters

value

unknown

The value to normalize (could be [id, label], {"id": 0, "display_name": ""}, or already normalized)

Returns

unknown

The normalized ID value, or the original value if it's not a legacy format