Skip to content

Function: isSortRefFeatureValue()

@kortexya/reasoninglayer


@kortexya/reasoninglayer / isSortRefFeatureValue

isSortRefFeatureValue(value): value is SortRefFeatureValue

Defined in: src/utils/discrimination.ts:48

Type guard for a sort named as a feature value ({sort_ref, sort_name?}).

unknown

Any value, typically one entry of a listed term’s features.

value is SortRefFeatureValue

true if the value is a SortRefFeatureValue.

A sort value used to arrive as {term_id}, indistinguishable from a term reference (#353). Use this guard to keep sort ids apart from term ids, for example when collecting the term ids a rule mentions.

import { isSortRefFeatureValue } from '@kortexya/reasoninglayer';
const of = rule.head.features['of'];
if (isSortRefFeatureValue(of)) {
console.log(of.sort_name ?? of.sort_ref);
}