list.type()
The list.type() or list.nth-type() function returns the type of all or selected $n indexes of $list.
// Functions.
@use 'get/get.map.function';
@use 'remove/remove.map.function';
// The `list.type()` function.
@function type($list, $n...) {
$result: if(list.length($n) > 0, $n, $list);
@for $i from 1 through list.length($result) {
$result: list.set-nth(
$result,
$i,
meta.type-of(
list.nth($list, if(list.length($n) > 0, list.nth($result, $i), $i))
)
);
}
@return if(list.length($result) > 0, $result, null);
}https://github.com/angular-package/sass/blob/main/list/_list.type.function.scss
Parameters
$list
$listThe list to check type of all or given $n.
$n...
$n...Indexes of number type to check their types in $list.
Return
The list with the types of the given $n indexes.
Examples
All types
Selected
Not in range
Last updated