Options
All
  • Public
  • Public/Protected
  • All
Menu

Module object

Utility functions for object.

Index

Functions

isObjectEmpty

  • isObjectEmpty(obj: object): obj is {}
  • Checks if an object is empty (has no keys).

    Parameters

    • obj: object

      The object to check.

    Returns obj is {}

    True if the object is empty, false otherwise.

mapToObject

  • mapToObject<T>(map: Map<string, T>): {}
  • Converts a Map to an object.

    Type parameters

    • T

    Parameters

    • map: Map<string, T>

      The map to convert from.

    Returns {}

    A new object with the same key/value pairs from the map.

    • [key: string]: T | undefined

objectHasProperty

  • objectHasProperty<T, P>(obj: T, property: P): obj is T & {}
  • Checks if an object has a given property.

    Type parameters

    • T: {}

    • P: string | number

    Parameters

    • obj: T

      The object to check in.

    • property: P

      The name of the property (key) to check for.

    Returns obj is T & {}

    True if the property is present in the object, false otherwise.

objectToMap

  • objectToMap<T>(obj: {}): Map<string, T>
  • Converts an object into a proper Map.

    Type parameters

    • T

    Parameters

    • obj: {}

      The object to convert.

      • [key: string]: T

    Returns Map<string, T>

    A new map with the keys from obj and their values.

Generated using TypeDoc