Skip to content

Instantly share code, notes, and snippets.

@IainIsCreative
Created July 1, 2015 15:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IainIsCreative/c9e74ae8c6169f7cbcf6 to your computer and use it in GitHub Desktop.
Save IainIsCreative/c9e74ae8c6169f7cbcf6 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
<p class="output">
The output number is
</p>
// ----
// libsass (v3.2.5)
// ----
/**
*
* Is there any way to fetch the last key and a specific key inside it?
*
**/
$map: (
key-1: (
first: true,
number: 1,
),
key-2: (
first: false,
number: 2,
),
);
// Map fetch function by Hugo Giraudel
@function map-fetch($map, $keys) {
@each $key in $keys {
$map: map-get($map, $key);
}
@return $map;
}
.output:after {
content: '' + map-fetch($map, key-2 number);
}
/**
*
* Is there any way to fetch the last key and a specific key inside it?
*
**/
.output:after {
content: "2";
}
<p class="output">
The output number is
</p>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment