mobx-keystone

    Function findParent

    • Iterates through all the parents (from the nearest until the root) until one of them matches the given predicate. If the predicate is matched it will return the found node. If none is found it will return undefined.

      Type Parameters

      • T extends object = any

        Parent object type.

      Parameters

      • child: object

        Target object.

      • predicate: (parentNode: object) => boolean

        Function that will be run for every parent of the target object, from immediate parent to the root.

      • maxDepth: number = 0

        Max depth, or 0 for infinite.

      Returns undefined | T

    MMNEPVFCICPMFPCPTTAAATR