Skip to content

Commit 18621e3

Browse files
committed
refactor: replace nth() with list.nth()
1 parent 99319b1 commit 18621e3

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

scss/functions/_assert.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@use "sass:list";
12
@use "sass:math";
23

34
// Ascending
@@ -23,7 +24,7 @@
2324
@mixin assert-starts-at-zero($map, $map-name: "$grid-breakpoints") {
2425
@if length($map) > 0 {
2526
$values: map-values($map);
26-
$first-value: nth($values, 1);
27+
$first-value: list.nth($values, 1);
2728
@if $first-value != 0 {
2829
@warn "First breakpoint in #{$map-name} must start at 0, but starts at #{$first-value}.";
2930
}

scss/mixins/_breakpoints.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@use "sass:list";
12
@use "../variables" as *;
23

34
// Breakpoint viewport sizes and media queries.
@@ -21,7 +22,7 @@
2122
@if not $n {
2223
@error "breakpoint `#{$name}` not found in `#{$breakpoints}`";
2324
}
24-
@return if($n < length($breakpoint-names), nth($breakpoint-names, $n + 1), null);
25+
@return if($n < length($breakpoint-names), list.nth($breakpoint-names, $n + 1), null);
2526
}
2627

2728
// Minimum breakpoint width. Null for the smallest (first) breakpoint.

scss/mixins/_transition.scss

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// stylelint-disable property-disallowed-list
2+
@use "sass:list";
23
@use "../variables" as *;
34

45
@mixin transition($transition...) {
@@ -15,11 +16,11 @@
1516
}
1617

1718
@if $enable-transitions {
18-
@if nth($transition, 1) != null {
19+
@if list.nth($transition, 1) != null {
1920
transition: $transition;
2021
}
2122

22-
@if $enable-reduced-motion and nth($transition, 1) != null and nth($transition, 1) != none {
23+
@if $enable-reduced-motion and list.nth($transition, 1) != null and list.nth($transition, 1) != none {
2324
@media (prefers-reduced-motion: reduce) {
2425
transition: none;
2526
}

scss/mixins/_utilities.scss

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@use "sass:list";
12
@use "sass:meta";
23
@use "../variables" as *;
34
@use "../vendor/rfs" as *;
@@ -14,7 +15,7 @@
1415
$values: map-get($utility, values);
1516

1617
// If the values are a list or string, convert it into a map
17-
@if meta.type-of($values) == "string" or meta.type-of(nth($values, 1)) != "list" {
18+
@if meta.type-of($values) == "string" or meta.type-of(list.nth($values, 1)) != "list" {
1819
$values: zip($values, $values);
1920
}
2021

@@ -27,7 +28,7 @@
2728
}
2829

2930
// Use custom class if present
30-
$property-class: if(map-has-key($utility, class), map-get($utility, class), nth($properties, 1));
31+
$property-class: if(map-has-key($utility, class), map-get($utility, class), list.nth($properties, 1));
3132
$property-class: if($property-class == null, "", $property-class);
3233

3334
// Use custom CSS variable name if present, otherwise default to `class`

0 commit comments

Comments
 (0)