mirror of https://github.com/vizality/vizality
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
639 B
33 lines
639 B
/// Fetch nested keys
|
|
/// @param {Map} $map - Map
|
|
/// @param {Arglist} $keys - Keys to fetch
|
|
/// @return {*}
|
|
|
|
@function map-deep-get($map, $keys...) {
|
|
@each $key in $keys {
|
|
$map: map-get($map, $key);
|
|
}
|
|
|
|
@return $map;
|
|
}
|
|
|
|
// Example
|
|
// ********************
|
|
|
|
// $grid-configuration: (
|
|
// 'columns': 12,
|
|
// 'layouts': (
|
|
// 'small': 800px,
|
|
// 'medium': 1000px,
|
|
// 'large': 1200px,
|
|
// ),
|
|
// );
|
|
|
|
// // Without `map-deep-get`
|
|
// $medium: map-get(map-get($grid-configuration, 'layouts'), 'medium');
|
|
|
|
// // With `map-deep-get`
|
|
// $medium: map-deep-get($grid-configuration, 'layouts', 'medium');
|
|
|
|
// *********************
|