Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "object-utils"

Index

Functions

clearNulls

  • clearNulls(obj: any): object
  • Deletes all properties/entries within an object or an array which are null, undefined or empty object.

    Note that empty arrays are not cleared!

    example

    clearNulls([ { foo: 'foo', bar: false, baz: null }, { }, [ ] ]); returns [ { foo: 'foo', bar: false, }, [ ] ]

    Parameters

    • obj: any

      The object to clean

    Returns object

clone

  • clone<T>(obj: T | T[]): T
  • Type parameters

    • T

    Parameters

    • obj: T | T[]

    Returns T

    A copy of @param obj It can be an array, object, class or primitive type.

convertToTypedClass

  • convertToTypedClass<T>(type: any, unTypedItem: any): T
  • Creates a new instance of @param type and copies all values from

    Type parameters

    • T

    Parameters

    • type: any
    • unTypedItem: any

      with a simple for in loop. Works non-recursively

    Returns T

findKeyForValue

  • findKeyForValue(obj: any, value: any): string | number | undefined
  • Finds the enum key for a specfic value in an object, class or Enum

    Parameters

    • obj: any

      The object to check, e.g. an Enum

    • value: any

      A value from within the object

    Returns string | number | undefined

isObject

  • isObject(obj: any): boolean
  • Checks if @param obj is not null and is an object.

    Parameters

    • obj: any

    Returns boolean

Generated using TypeDoc