feat(styles): add custom get deep maps function
This commit is contained in:
		
							
								
								
									
										19
									
								
								styles/base/_functions.scss
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								styles/base/_functions.scss
									
									
									
									
									
										Normal 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; | ||||
| } | ||||
		Reference in New Issue
	
	Block a user