feat(styles): add custom get deep maps function

This commit is contained in:
Walid 2022-04-05 03:10:16 +00:00
parent d2d67c9f2e
commit adc25d73d3
No known key found for this signature in database
GPG Key ID: 4BDA1ABD227F9279

View File

@ -0,0 +1,19 @@
@use 'sass:map';
@use 'sass:meta';
@use 'sass:list';
@function custom-map-get($map, $keys...) {
$current-map: $map;
$i: 1;
@if meta.type-of($map) == map {
@while $i <= length($keys) {
$current-map: map.get($current-map, list.nth($keys, $i));
$i: $i + 1;
}
} @else {
@error "The #{$current-map} provided is not an actual map.";
}
@return $current-map;
}