Skip to Content
📣 We just released Svelte Flow 1.0 Alpha — try it out and give us your feedback!

isNode()

Source on GitHub 

Test whether an object is usable as an Node. In TypeScript this is a type guard that will narrow the type of whatever you pass in to Node if it returns true.

import { isNode } from '@xyflow/svelte'; const node = { id: 'node-a', data: { label: 'node', }, position: { x: 0, y: 0, }, }; if (isNode(node)) { // .. }

Signature

Parameters:
NameTypeDefault
elementunknown

The element to test

Returns:
boolean

A boolean indicating whether the element is an Node

Last updated on