Options
All
  • Public
  • Public/Protected
  • All
Menu

Utilities to perform common object operations

Hierarchy

  • ObjectUtils

Index

Methods

Static clone

  • clone(object: any): any

Static getKeys

  • getKeys(object: any): string[]
  • Get the list of literals for a given object. Note that only 1rst depth keys are providen

    Parameters

    • object: any

      A valid object

    Returns string[]

    List of strings with the first level object key names in the same order as defined on the object instance

Static isEqualTo

  • isEqualTo(object1: any, object2: any): boolean
  • Check if two provided objects are identical. Note that properties order does not alter the comparison. So if two objects have the same properties with exactly the same values, but they appear in a different order on both objects, this method will consider them as equal.

    Parameters

    • object1: any

      First object to compare

    • object2: any

      Second object to compare

    Returns boolean

    true if objects are exactly the same, false if not

Static isObject

  • isObject(value: any): boolean
  • Tells if the given value is an object or not

    Parameters

    • value: any

      A value to check

    Returns boolean

    true if the given value is an object, false otherwise

Static isStringFound

  • isStringFound(object: any, str: string, caseSensitive?: boolean): boolean
  • Check if the provided string is found inside the provided object structure. This method will recursively search inside all the provided object properties and test if the provided string is found. Search will be performed inside any object structures like arrays or other objects. Result will be positive even if any string on the object contains the searched text as a substring.

    Parameters

    • object: any

      The object where the string will be looked for

    • str: string

      The string that will be searched on the object

    • Default value caseSensitive: boolean = true

      True (default) to perform a case sensitive search, false otherwise

    Returns boolean

    True if the string is found anywhere inside the provided object, false otherwise

Static merge

  • merge(destination: any, source: any): any
  • Combine a source object into a destination one by applying a deep merge. All properties from the source will be replaced into the destination object, without altering the destination properties that are not found on source.

    Parameters

    • destination: any

      The object that will be overriden with the source one. The given instance will be permanently modified.

    • source: any

      An object to merge into the destination one. This instance will not be modified

    Returns any

    The destination object instance after being modified by merging the source object into it

Generated using TypeDoc