utils/objecttomap

Api-module icon module

Functions

  • Chevron-right icon

    objectToMap( obj = { obj.[key: string] } ) → Map<string, T>

    Transforms object to map.

    const map = objectToMap( { 'foo': 1, 'bar': 2 } );
    map.get( 'foo' ); // 1
    
    Copy code

    Note: For mixed data (Object or Iterable) there's a dedicated toMap function.

    Type parameters

    T

    Parameters

    obj : undefined | null | object

    Object to transform.

    Properties
    obj.[key: string] : T

    Returns

    Map<string, T>

    Map created from object.