hasRelationship
The hasRelationship
method returns a boolean indicating whether a given Relationship
exists in the Relationships
object.
hasRelationship(indexId: string): boolean
Type | Description | |
---|---|---|
indexId | string | |
returns | boolean | Whether a |
Example
This example shows two simple Relationship
existence checks.
const relationships = createRelationships(
createStore(),
).setRelationshipDefinition('petSpecies', 'pets', 'species', 'species');
console.log(relationships.hasRelationship('petSpecies'));
// -> true
console.log(relationships.hasRelationship('petColor'));
// -> false