// ============================================================================
// 02-TOOLS -> FUNCTIONS -> #DEEP-MAP-GET
// ============================================================================


/// Deep map get
///
/// Returns a value from a nested map key
///
/// @param {Map} $map
/// @param {List} $keys
///
/// @return {*} - Nested map key value
///
/// @example scss
///   .element {
///     font-size: deep-map-get($typography, 'h1', 'line-height');
///   }
///
/// @access public

@function deep-map-get ($map, $keys...) {
    @if type-of($map) != 'map' {
        @error "The argument $map: `#{$map}` is of incorrect type: `#{type-of($map)}`. Type of `Map` is required.";
    }
  
    @each $key in $keys {
        $map: map-get($map, $key);
    }
  
    @return $map;
}