Sha256: 50dfa2bae5325e4f9305c31167eb6e3ebd41af0611f41cef4cf9abc2d49b7258

Contents?: true

Size: 866 Bytes

Versions: 1

Compression:

Stored size: 866 Bytes

Contents

// Fetch value from key in map
// -------------------------------------------------------------------------------
// @param $map [map] : map to fetch from
// @param $keys [string | list] : string of key, or list of strings
// -------------------------------------------------------------------------------
// @return fetched literal | false

@function flint-map-fetch($map, $keys) {
	$key: nth($keys, 1);
	$length: length($keys);
	$value: map-get($map, $key);

	@if $value != null {
		@if $length > 1 {
			$rest: ();

			@for $i from 2 through $length {
				$rest: append($rest, nth($keys, $i))
			}

			@return flint-map-fetch($value, $rest);

		} @else {
			@return $value;
		}
	} @else {
		@warn "Invalid arguments passed to function: flint-map-fetch(#{$map}, #{$keys}). One or more of the keys do not exist.";
		@return false;
	}
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
flint-gs-1.7.1 stylesheets/flint/functions/lib/_map-fetch.scss