Function getPropertyValue

  • Gets the value of a property on an object.

    Example

    const obj = { a: { b: 123 } };
    getPropertyValue(obj, 'a.b');
    // => 123

    const obj2 = { a: { b: null } };
    getPropertyValue(obj2, 'a.b.c');
    // => undefined

    Type Parameters

    • T

      The type of the object to get the property from.

    Parameters

    • obj: T

      The object to get the property from.

    • prop: PropertyKey

      The property key to get the value of.

    Returns any

    The value of the property, or undefined if it doesn't exist.

Generated using TypeDoc v0.24.7