map.has-keys()
The map.has-keys() function checks whether $map contains $keys.
// Sass.
@use 'sass:list';
@use 'sass:map';
// The `map.has-keys()` function.
@function has-keys($map, $keys...) {
$has: ();
@each $key in $keys {
$has: list.append(
$has,
if(
list.separator($key) == comma,
map.has-key($map, $key...),
map.has-key($map, $key)
)
);
}
@return if(list.index($has, false), false, true);
}https://github.com/angular-package/sass/blob/main/map/_map.has-keys.function.scss
Parameters
$map
$mapA map to check whether it has all $keys.
$keys...
$keys...The keys to check if $map contains them.
Return
The return value is a bool indicating $map contains $keys.
Examples
Last updated
Was this helpful?