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 useable 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

#Params
#item
any
#Returns
boolean
Tests if whatever you passed in can be used as an node. If you're using TypeScript, this function actions as a type guard and will narrow the type of whatever you pass in to an Node if it returns true.
Last updated on