-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path_lists.scss
44 lines (40 loc) · 863 Bytes
/
_lists.scss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
@use 'sass:list';
@use 'sass:meta';
/// Get the first `$list` element
///
/// @param {List} $list
/// @return {*}
/// @group List
/// @author Felix Scholze
/// @since v1.3.0
///
/// @example
/// $my-list(1, 2, 3, 4, 5)
/// @debug first-of-list($my-list);
/// //=> 1
///
@function first-of-list($list) {
@if meta.type-of($list) != list {
@error '❌ ===> #{$list} is not a list';
}
@return list.nth($list, -1);
}
/// Get the last `$list` element
///
/// @param {List} $list
/// @return {*}
/// @group List
/// @author Felix Scholze
/// @since v1.3.0
///
/// @example
/// $my-list(1, 2, 3, 4, 5)
/// @debug last-of-list($my-list);
/// //=> 5
///
@function last-of-list($list) {
@if meta.type-of($list) != list {
@error '❌ ===> #{$list} is not a list';
}
@return list.nth($list, -1);
}