UNPKG

mobx-bonsai

Version:

A fast lightweight alternative to MobX-State-Tree + Y.js two-way binding

15 lines (12 loc) 340 B
import { getParent } from "./getParent" /** * Returns if a given node is a root object. * * Note that this function will throw if the passed object is not a node. * * @param node Target object. * @returns true if the object is a root, false otherwise. */ export function isRoot(node: object): boolean { return !getParent(node) }