Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "util/object"

Index

Functions

isObject

  • isObject(value: unknown): boolean
  • Checks if the provided value is an object.

    Parameters

    • value: unknown

      Value to check.

    Returns boolean

isPlainObject

  • isPlainObject(value: unknown): boolean
  • Checks if the provided value is a plain javascript object.

    Parameters

    • value: unknown

      Value to check.

    Returns boolean

navigateToPropertyPath

  • navigateToPropertyPath<T>(obj: T, path: string, callback: (obj: Obj, key: string) => void): void
  • Traverses a string path for an object to find the property it is pointing to.

    Once the property is found a callback function is called passing in the property's parent object and the property name.

    const data = {
      nested: {
       anotherNested: {
         property: 'value',
         number: 66
       }
      }
    };
    
    navigateToPropertyPath(data, 'nested.anotherNested.property', (obj, property) => {
     console.log(obj, property);
    });
    
    // output: {property: 'value', number: 66} property

    Type parameters

    Parameters

    • obj: T

      Object to traverse.

    • path: string

      Path to a property on the obj.

    • callback: (obj: Obj, key: string) => void

      Callback to be called when the property is found.

        • (obj: Obj, key: string): void
        • Parameters

          • obj: Obj
          • key: string

          Returns void

    Returns void

prototypeAugment

  • prototypeAugment(target: Obj, source: Obj): Obj
  • Add an object's functionality to your target object's prototype chain.

    Parameters

    • target: Obj

      Target object to augment.

    • source: Obj

      Source to use for augmentation.

    Returns Obj

Generated using TypeDoc