isEdge()
Test whether an object is useable as an Edge
. In TypeScript
this is a type guard that will narrow the type of whatever you pass in to
Edge
if it returns true
.
import { isEdge } from '@xyflow/svelte';
const edge = {
id: 'edge-a',
source: 'a',
target: 'b',
};
if (isEdge(edge)) {
// ..
}
Signature
Name | Type |
---|---|
#Params |
|
# item | any |
#Returns |
|
boolean Tests if whatever you passed in can be used as an edge. If
you're using TypeScript, this function actions as a type guard and will
narrow the type of whatever you pass in to an Edge if it returns true. |