]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Update `map-safe-get` conditional check and change parameter to `$key`
authorBrett Mason <brettsmason@gmail.com>
Tue, 17 Jan 2017 11:27:11 +0000 (11:27 +0000)
committerBrett Mason <brettsmason@gmail.com>
Tue, 17 Jan 2017 11:27:11 +0000 (11:27 +0000)
scss/util/_value.scss

index 6e8e66ca3d284dbd8a7c913cb7d4edc5662e4319..a063a82af603421d716c90c74a4a6c1a7b23ae58 100644 (file)
 /// Safely return a value from a map.
 ///
 /// @param {Map} $map - Map to retrieve a value from.
-/// @param {String} $name - Name of the map key.
+/// @param {String} $key - Name of the map key.
 ///
 /// @returns {List} Found value.
-@function map-safe-get($map, $name) {
-  @if (type-of($map) == 'map') {
-    @if (map-has-key($map, $name)) {
-      @return map-get($map, $name);
+@function map-safe-get($map, $key) {
+  @if (type-of($map) == 'map' or (type-of($map) == 'list' and length($map) == 0)) {
+    @if (map-has-key($map, $key)) {
+      @return map-get($map, $key);
     }
     @else {
-      @error 'Key: `#{$name}` is not available in `#{$map}`';
+      @error 'Key: `#{$key}` is not available in `#{$map}`';
     }
   }
   @else {