Reference
utils
isEdge()

isEdge()

Source on GitHub (opens in a new tab)

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

#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.