Sha256: 50c055e3c1c05e10319bd268cb0a294505d953bd9edc09ed42713ea0c90be2ce
Contents?: true
Size: 930 Bytes
Versions: 14
Compression:
Stored size: 930 Bytes
Contents
// Fetch value from key in map // ------------------------------------------------------------------------------- // @dependence `map-fetche()` // ------------------------------------------------------------------------------- // @param $i [Map] : map // @param $n [Keys...] : keys // ------------------------------------------------------------------------------- // @return [Value] | false @function map-fetch($map, $keys) { $key: nth($keys, 1); $length: length($keys); $value: map-get($map, $key); // check if value equals NULL (meaning the @param was incorrect and the map doesn't exist) @if $value == NULL { @warn "Invalid arguments padded to function: `map-fetch(#{$map}, #{$keys})`"; @return false; } @else { @if $length > 1 { $rest: (); @for $i from 2 through $length { $rest: append($rest, nth($keys, $i)) } @return map-fetch($value, $rest); } @else { @return $value; } } }
Version data entries
14 entries across 14 versions & 1 rubygems