Sha256: 1c0854d4b4e5fcd5737f47500860301e452d589531e3bc1158f2840e0ba44d20

Contents?: true

Size: 734 Bytes

Versions: 2

Compression:

Stored size: 734 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) {
	$has-key: flint-is-map($map) and map-has-key($map, nth($keys, 1)) and map-get($map, nth($keys, 1)) or false;
	$length: length($keys);

	@if $has-key and $length > 1 {
		$remainder: ();

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

		@return flint-map-fetch($has-key, $remainder);
	}

	@return $has-key;
}

Version data entries

2 entries across 2 versions & 1 rubygems

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