jty
    Preparing search index...

    Function hasPath

    • Checks if the provided value has the a path of properties

      Type Parameters

      • K extends readonly PropertyKey[]

      Parameters

      • x: unknown

        a value that may possibly have some properties

      • ...propNames: readonly [K]

        one or more property names

      Returns x is DeepRecord<K, object>

      const x = { foo: { bar: { baz: undefined }}}
      hasPath(x, 'foo', 'bar') => true
      hasPath(x, 'foo', 'bar', 'baz') => true
      hasPath(x, 'foo', 'hello', 'baz') => false
      hasPath(x, 'foo', 'bar', 'hello') => false