// Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
// See LICENSE in the project root for license information.

// ---------------------------------------------------------------------
// Variables are defined by baseline Design Tokens

/// This function is to be used to return nested key values within a nested map
/// @group utility
/// @parameter {Variable} $map [null] - pass in map to be evaluated
/// @parameter {Variable} $keys [null] - pass in keys to be evaluated
/// @link https://css-tricks.com/snippets/sass/deep-getset-maps/ Article from CSS-Tricks
/// @example scss - pass map and strings/variables into function
///   $tokens: (
///     'size': (
///       'eighth': $size-eighth,
///       'quarter': $size-quarter
///     )
///   );
///   $var: auro_map-deep-get($tokens, 'size', 'eighth'); => $size-eighth
/// @example scss - import dependency
///   @import "./node_modules/@aurodesignsystem/webcorestylesheets/dist/utilityFunctions/map-deep-get";

@function auro_map-deep-get($map, $keys...) {
  @each $key in $keys {
    $map: map-get($map, $key);
  }

  @return $map;
}
