Function: isA()
isA(
sub,code,anchor):boolean
True when code is-a anchor - the same code, or a (transitive) descendant of it.
Parameters
sub
The subsumption index (from buildSubsumption).
code
string
The candidate code.
anchor
string
The ancestor code to test against.
Returns
boolean
Whether code is anchor or a descendant of it.
Example
import { loadCodeSystem, buildSubsumption, isA } from "@cosyte/terminology";
const cs = loadCodeSystem({
format: "fhir",
resource: { resourceType: "CodeSystem", concept: [{ code: "p", concept: [{ code: "c" }] }] },
});
isA(buildSubsumption(cs), "c", "p"); // => true