1 /// Removes a specific item from a list.
2 /// @author Hugo Giraudel
3 /// @param {list} $list List.
4 /// @param {integer} $index Index.
5 /// @return {list} Updated list.
6 @function remove-nth($list, $index) {
10 @if type-of($index) != number {
11 @warn "$index: #{quote($index)} is not a number for `remove-nth`.";
13 @else if $index == 0 {
14 @warn "List index 0 must be a non-zero integer for `remove-nth`.";
16 @else if abs($index) > length($list) {
17 @warn "List index is #{$index} but list is only #{length($list)} item long for `remove-nth`.";
22 $index: if($index < 0, length($list) + $index + 1, $index);
24 @for $i from 1 through length($list) {
27 $result: append($result, nth($list, $i));
38 /// Gets a value from a map.
39 /// @author Hugo Giraudel
40 /// @param {map} $map Map.
41 /// @param {string} $keys Key(s).
42 /// @return {string} Value.
43 @function val($map, $keys...) {
45 @if nth($keys, 1) == null {
46 $keys: remove-nth($keys, 1);
50 $map: map-get($map, $key);
57 /// Gets a duration value.
58 /// @param {string} $keys Key(s).
59 /// @return {string} Value.
60 @function _duration($keys...) {
61 @return val($duration, $keys...);
64 /// Gets a font value.
65 /// @param {string} $keys Key(s).
66 /// @return {string} Value.
67 @function _font($keys...) {
68 @return val($font, $keys...);
71 /// Gets a misc value.
72 /// @param {string} $keys Key(s).
73 /// @return {string} Value.
74 @function _misc($keys...) {
75 @return val($misc, $keys...);
78 /// Gets a palette value.
79 /// @param {string} $keys Key(s).
80 /// @return {string} Value.
81 @function _palette($keys...) {
82 @return val($palette, $keys...);
85 /// Gets a size value.
86 /// @param {string} $keys Key(s).
87 /// @return {string} Value.
88 @function _size($keys...) {
89 @return val($size, $keys...);