Tree
/ API Reference
Tree
/ API Reference

get

Gets a node by its id.

The Gist

import { get } from '@weser/tree'

const node = get(tree, 'node-id')

Parameters

ParameterTypeDescription
rootNodeTThe root node of the tree.
idstringThe id of the node to get.

Returns

(T | null) The node with the given id or null if no node with the given id was found.

On this page