Function deepAccessObject

  • Access property in an object using a string path. Similar to lodash.get


    const obj = {a: {b: {c: 1}}}
    const c = deepAccessObject(['a', 'b', 'c'], obj)
    console.log(c) // 1


    • access: string | string[]

      path to access

    • tar: any

      target object

    • throwOnInvalid: boolean = false

      throw error if invalid access or property is undefined. Default is false

    Returns any

Generated using TypeDoc